在 Spring Boot 中加载现有的数据库(Oracle)表

Posted

技术标签:

【中文标题】在 Spring Boot 中加载现有的数据库(Oracle)表【英文标题】:Load an existing database(Oracle) table in spring boot 【发布时间】:2019-08-11 11:58:41 【问题描述】:

我正在尝试在 Spring Boot 中加载现有的 Oracle 数据库表(注意:表中有许多列和行,并应用了所有约束)。另外,让我知道实现这一目标的最佳方法。我尝试通过 JPA 加载此表,但它不起作用。让我知道是否需要更多信息。谢谢!!

1.SpringBootApplication.class

@SpringBootApplication
@EntityScan("RecordDisposal.dao")
public class RecordDisposalApplication

    public static void main(String[] args) 
    
        SpringApplication.run(RecordDisposalApplication.class, args);
    

2.MainController.class

@RestController
    public class MainController 
    
        public TSRecord tsrecord;
        @RequestMapping("/test")
        @ResponseBody
        public Iterable<TSRecord> Dashboard() 
        
            return tsrecord.findAll();
        
    

3.Repository.class

@Repository
public interface TSRecord extends JpaRepository<TSRecord, Long> 


4.Entity.class

@Entity
@Table(name = "TSRECORD")
public class TSRecord 

    @Id
    @GeneratedValue
    @Column(name ="URI",columnDefinition ="NUMBER(38,0)")
    public int URI;

    @Column(name ="RECORDID",columnDefinition ="NVARCHAR2(50 CHAR)")
    public String RECORDID;

    @Column(name ="TITLE",columnDefinition ="NVARCHAR2(254 CHAR)")
    public String TITLE;

    @Column(name ="RCSCHEDULEURI",columnDefinition ="NUMBER(38,0)")
    public int RCSCHEDULEURI;

    @Column(name ="RCRECTYPEURI",columnDefinition ="NUMBER(38,0)")
    public int RCRECTYPEURI;

    @Column(name ="RCFILEPLANURI",columnDefinition ="NUMBER(38,0)")
    public int RCFILEPLANURI;

    @Column(name ="RCSECLEVEL",columnDefinition ="NUMBER(38,0)")
    public int RCSECLEVEL;

    @Column(name ="RCNOTES",columnDefinition ="CHAR(1 BYTE)")
    public String RCNOTES;

    @Column(name ="ACCESSIONNBR",columnDefinition ="NUMBER(38,0)")
    public int ACCESSIONNBR;

    @Column(name ="EXTERNALID",columnDefinition ="NVARCHAR2(50 CHAR)")
    public String EXTERNALID;

    @Column(name ="PRIORITY",columnDefinition ="NCHAR(5 CHAR)")
    public String PRIORITY;

    @Column(name ="ISPART",columnDefinition ="CHAR(1 BYTE)")
    public String ISPART;

    @Column(name ="ISROOT",columnDefinition ="CHAR(1 BYTE)")
    public String ISROOT;

    @Column(name ="ISRELATED",columnDefinition ="CHAR(1 BYTE)")
    public String ISRELATED;

    @Column(name ="ISPARENT",columnDefinition ="CHAR(1 BYTE)")
    public String ISPARENT;

    @Column(name ="ISATTACHED",columnDefinition ="CHAR(1 BYTE)")
    public String ISATTACHED;

    @Column(name ="FULLRECORDID",columnDefinition ="NVARCHAR2(50 CHAR)")
    public String FULLRECORDID;

    @Column(name ="CONSIGNMENT",columnDefinition ="NVARCHAR2(50 CHAR)")
    public String CONSIGNMENT;

    @Column(name ="CURRDISP",columnDefinition ="NUMBER(38,0)")
    public int CURRDISP;

    @Column(name ="RCCLASS",columnDefinition ="NUMBER(38,0)")
    public int RCCLASS;

    @Column(name ="RCCONTAINERURI",columnDefinition ="NUMBER(38,0)")
    public int RCCONTAINERURI;

    @Column(name ="RCACCESSLOC",columnDefinition ="NUMBER(38,0)")
    public int RCACCESSLOC;

    @Column(name ="RCSTRUCTUREDTITLE",columnDefinition ="NVARCHAR2(512 CHAR)")
    public String RCSTRUCTUREDTITLE;

    @Column(name ="REGDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String REGDATETIME;

    @Column(name ="CREATIONDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String CREATIONDATETIME;

    @Column(name ="CLOSEDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String CLOSEDATETIME;

    @Column(name ="RCDUEDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String RCDUEDATETIME;

    @Column(name ="LASTACTIONDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String LASTACTIONDATETIME;


    @Column(name ="INACTIVEDATETIME",columnDefinition ="CHAR(15 BYTE)")
    public String INACTIVEDATETIME;

    @Column(name ="RCFINALIZEDDATE",columnDefinition ="CHAR(15 BYTE)")
    public String RCFINALIZEDDATE;

    @Column(name ="RCREVIEWDATE",columnDefinition ="CHAR(15 BYTE)")
    public String RCREVIEWDATE;

    @Column(name ="HASHOLD",columnDefinition ="CHAR(1 BYTE)")
    public String HASHOLD;

    @Column(name ="RCDATEPUBLISHED",columnDefinition ="CHAR(15 BYTE)")
    public String RCDATEPUBLISHED;

    @Column(name ="RCACCESSISCONT",columnDefinition ="CHAR(1 BYTE)")
    public String RCACCESSISCONT;

    @Column(name ="RCLINKEDTOCOUNT",columnDefinition ="NUMBER(38,0)")
    public int RCLINKEDTOCOUNT;

    @Column(name ="RCRECTYPESECFILTER",columnDefinition ="NUMBER(38,0)")
    public int RCRECTYPESECFILTER;

    @Column(name ="RCAUTOPARTURI",columnDefinition ="NUMBER(38,0)")
    public int RCAUTOPARTURI;

    @Column(name ="SYSLASTUPDATED",columnDefinition ="CHAR(15 BYTE)")
    public String SYSLASTUPDATED;

    @Column(name ="RCORIGIN",columnDefinition ="NUMBER(38,0)")
    public int RCORIGIN;

    @Column(name ="RCDATEIMPORTED",columnDefinition ="CHAR(15 BYTE)")
    public String RCDATEIMPORTED;

    @Column(name ="RCSPURL",columnDefinition ="NVARCHAR2(255 CHAR)")
    public String RCSPURL;

    @Column(name ="RCSPGUID",columnDefinition ="NCHAR(32 CHAR)")
    public String RCSPGUID;

    @Column(name ="RCSPFARMID",columnDefinition ="NCHAR(32 CHAR)")
    public String RCSPFARMID;

    @Column(name ="RCSPLISTTYPE",columnDefinition ="NVARCHAR2(255 CHAR)")
    public String RCSPLISTTYPE;

    @Column(name ="RCSPSITECOLLID",columnDefinition ="NCHAR(32 CHAR)")
    public String RCSPSITECOLLID;

    @Column(name ="RCMEDIATYPE",columnDefinition ="NUMBER(38,0)")
    public int RCMEDIATYPE;

    @Column(name ="RCFOLDERORIGIN",columnDefinition ="NUMBER(38,0)")
    public int RCFOLDERORIGIN;

    @Column(name ="RC1CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC1CAVEAT;

    @Column(name ="RC2CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC2CAVEAT;

    @Column(name ="RC3CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC3CAVEAT;

    @Column(name ="RC4CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC4CAVEAT;

    @Column(name ="RC5CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC5CAVEAT;

    @Column(name ="RC6CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC6CAVEAT;

    @Column(name ="RC7CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC7CAVEAT;

    @Column(name ="RC8CAVEAT",columnDefinition ="NUMBER(38,0)")
    public int RC8CAVEAT;

    @Column(name ="SYSLASTUPDATEDBY",columnDefinition ="NUMBER(38,0)")
    public int SYSLASTUPDATEDBY;

    @Column(name ="RCSCHINACTIVECALC",columnDefinition ="NUMBER(38,0)")
    public int RCSCHINACTIVECALC;

    @Column(name ="RCSCHINACTIVE",columnDefinition ="CHAR(8 CHAR)")
    public String RCSCHINACTIVE;

    @Column(name ="RCDISPOSALKEY",columnDefinition ="CHAR(9 CHAR)")
    public String RCDISPOSALKEY;

    @Column(name ="RCSCHDISPOSALKEY",columnDefinition ="CHAR(9 CHAR)")
    public String RCSCHDISPOSALKEY;

    @Column(name ="RCSCHDISPCALC",columnDefinition ="NUMBER(38,0)")
    public int RCSCHDISPCALC;

    @Column(name ="RCHASLONGEVITYFMT",columnDefinition ="CHAR(1 BYTE)")
    public String RCHASLONGEVITYFMT;

    @Column(name ="RCHASREDACTABLEFMT",columnDefinition ="CHAR(1 BYTE)")
    public String RCHASREDACTABLEFMT;

    @Column(name ="RCHASOCRFMT",columnDefinition ="CHAR(1 BYTE)")
    public String RCHASOCRFMT;

    @Column(name ="RCCLIENTRECORD",columnDefinition ="NUMBER(38,0)")
    public int RCCLIENTRECORD;

    @Column(name ="RCMATTERRECORD",columnDefinition ="NUMBER(38,0)")
    public int RCMATTERRECORD;

    @Column(name ="RCCONSIGNMENTURI",columnDefinition ="NUMBER(38,0)")
    public int RCCONSIGNMENTURI;

    @Column(name ="RCAUTOCONFIDENCE",columnDefinition ="NUMBER(38,0)")
    public int RCAUTOCONFIDENCE;

    @Column(name ="RCDATESUPERSEDED",columnDefinition ="CHAR(15 BYTE)")
    public String RCDATESUPERSEDED;

    @Column(name ="RCDATERECEIVED",columnDefinition ="CHAR(15 BYTE)")
    public String RCDATERECEIVED;

    @Column(name ="RCGEOGRAPHY",columnDefinition ="SDO_GEOMETRY")
    public String RCGEOGRAPHY;

    @Column(name ="RCNEEDSREVIEW",columnDefinition ="CHAR(1 BYTE)")
    public String RCNEEDSREVIEW;

    @Column(name ="RCNEEDSAUTHORIZATION",columnDefinition ="CHAR(1 BYTE)")
    public String RCNEEDSAUTHORIZATION;

    @Column(name ="RCAUTHORIZATIONMETHOD",columnDefinition ="NUMBER(38,0)")
    public int RCAUTHORIZATIONMETHOD;

    @Column(name ="RCREVIEWSTATE",columnDefinition ="NUMBER(38,0)")
    public int RCREVIEWSTATE;

    @Column(name ="RCREVIEWSTATEDATE",columnDefinition ="CHAR(15 BYTE)")
    public String RCREVIEWSTATEDATE;

    @Column(name ="RCREVIEWDUEDATE",columnDefinition ="CHAR(15 BYTE)")
    public String RCREVIEWDUEDATE;

    @Column(name ="RCACLGROUPKEY",columnDefinition ="NUMBER(38,0)")
    public int RCACLGROUPKEY;

    @Column(name ="RCACLCONTAINER",columnDefinition ="NUMBER(38,0)")
    public int RCACLCONTAINER;

    @Column(name ="RCACLEXCLUSION",columnDefinition ="NUMBER(38,0)")
    public int RCACLEXCLUSION;

    public int getURI() 
        return URI;
    

    public void setURI(int uRI) 
        URI = uRI;
    

    public String getRECORDID() 
        return RECORDID;
    

    public void setRECORDID(String rECORDID) 
        RECORDID = rECORDID;
    

    public String getTITLE() 
        return TITLE;
    

    public void setTITLE(String tITLE) 
        TITLE = tITLE;
    

    public int getRCSCHEDULEURI() 
        return RCSCHEDULEURI;
    

    public void setRCSCHEDULEURI(int rCSCHEDULEURI) 
        RCSCHEDULEURI = rCSCHEDULEURI;
    

    public int getRCRECTYPEURI() 
        return RCRECTYPEURI;
    

    public void setRCRECTYPEURI(int rCRECTYPEURI) 
        RCRECTYPEURI = rCRECTYPEURI;
    

    public int getRCFILEPLANURI() 
        return RCFILEPLANURI;
    

    public void setRCFILEPLANURI(int rCFILEPLANURI) 
        RCFILEPLANURI = rCFILEPLANURI;
    

    public int getRCSECLEVEL() 
        return RCSECLEVEL;
    

    public void setRCSECLEVEL(int rCSECLEVEL) 
        RCSECLEVEL = rCSECLEVEL;
    

    public String getRCNOTES() 
        return RCNOTES;
    

    public void setRCNOTES(String rCNOTES) 
        RCNOTES = rCNOTES;
    

    public int getACCESSIONNBR() 
        return ACCESSIONNBR;
    

    public void setACCESSIONNBR(int aCCESSIONNBR) 
        ACCESSIONNBR = aCCESSIONNBR;
    

    public String getEXTERNALID() 
        return EXTERNALID;
    

    public void setEXTERNALID(String eXTERNALID) 
        EXTERNALID = eXTERNALID;
    

    public String getPRIORITY() 
        return PRIORITY;
    

    public void setPRIORITY(String pRIORITY) 
        PRIORITY = pRIORITY;
    

    public String getISPART() 
        return ISPART;
    

    public void setISPART(String iSPART) 
        ISPART = iSPART;
    

    public String getISROOT() 
        return ISROOT;
    

    public void setISROOT(String iSROOT) 
        ISROOT = iSROOT;
    

    public String getISRELATED() 
        return ISRELATED;
    

    public void setISRELATED(String iSRELATED) 
        ISRELATED = iSRELATED;
    

    public String getISPARENT() 
        return ISPARENT;
    

    public void setISPARENT(String iSPARENT) 
        ISPARENT = iSPARENT;
    

    public String getISATTACHED() 
        return ISATTACHED;
    

    public void setISATTACHED(String iSATTACHED) 
        ISATTACHED = iSATTACHED;
    

    public String getFULLRECORDID() 
        return FULLRECORDID;
    

    public void setFULLRECORDID(String fULLRECORDID) 
        FULLRECORDID = fULLRECORDID;
    

    public String getCONSIGNMENT() 
        return CONSIGNMENT;
    

    public void setCONSIGNMENT(String cONSIGNMENT) 
        CONSIGNMENT = cONSIGNMENT;
    

    public int getCURRDISP() 
        return CURRDISP;
    

    public void setCURRDISP(int cURRDISP) 
        CURRDISP = cURRDISP;
    

    public int getRCCLASS() 
        return RCCLASS;
    

    public void setRCCLASS(int rCCLASS) 
        RCCLASS = rCCLASS;
    

    public int getRCCONTAINERURI() 
        return RCCONTAINERURI;
    

    public void setRCCONTAINERURI(int rCCONTAINERURI) 
        RCCONTAINERURI = rCCONTAINERURI;
    

    public int getRCACCESSLOC() 
        return RCACCESSLOC;
    

    public void setRCACCESSLOC(int rCACCESSLOC) 
        RCACCESSLOC = rCACCESSLOC;
    

    public String getRCSTRUCTUREDTITLE() 
        return RCSTRUCTUREDTITLE;
    

    public void setRCSTRUCTUREDTITLE(String rCSTRUCTUREDTITLE) 
        RCSTRUCTUREDTITLE = rCSTRUCTUREDTITLE;
    

    public String getREGDATETIME() 
        return REGDATETIME;
    

    public void setREGDATETIME(String rEGDATETIME) 
        REGDATETIME = rEGDATETIME;
    

    public String getCREATIONDATETIME() 
        return CREATIONDATETIME;
    

    public void setCREATIONDATETIME(String cREATIONDATETIME) 
        CREATIONDATETIME = cREATIONDATETIME;
    

    public String getCLOSEDATETIME() 
        return CLOSEDATETIME;
    

    public void setCLOSEDATETIME(String cLOSEDATETIME) 
        CLOSEDATETIME = cLOSEDATETIME;
    

    public String getRCDUEDATETIME() 
        return RCDUEDATETIME;
    

    public void setRCDUEDATETIME(String rCDUEDATETIME) 
        RCDUEDATETIME = rCDUEDATETIME;
    

    public String getLASTACTIONDATETIME() 
        return LASTACTIONDATETIME;
    

    public void setLASTACTIONDATETIME(String lASTACTIONDATETIME) 
        LASTACTIONDATETIME = lASTACTIONDATETIME;
    

    public String getINACTIVEDATETIME() 
        return INACTIVEDATETIME;
    

    public void setINACTIVEDATETIME(String iNACTIVEDATETIME) 
        INACTIVEDATETIME = iNACTIVEDATETIME;
    

    public String getRCFINALIZEDDATE() 
        return RCFINALIZEDDATE;
    

    public void setRCFINALIZEDDATE(String rCFINALIZEDDATE) 
        RCFINALIZEDDATE = rCFINALIZEDDATE;
    

    public String getRCREVIEWDATE() 
        return RCREVIEWDATE;
    

    public void setRCREVIEWDATE(String rCREVIEWDATE) 
        RCREVIEWDATE = rCREVIEWDATE;
    

    public String getHASHOLD() 
        return HASHOLD;
    

    public void setHASHOLD(String hASHOLD) 
        HASHOLD = hASHOLD;
    

    public String getRCDATEPUBLISHED() 
        return RCDATEPUBLISHED;
    

    public void setRCDATEPUBLISHED(String rCDATEPUBLISHED) 
        RCDATEPUBLISHED = rCDATEPUBLISHED;
    

    public String getRCACCESSISCONT() 
        return RCACCESSISCONT;
    

    public void setRCACCESSISCONT(String rCACCESSISCONT) 
        RCACCESSISCONT = rCACCESSISCONT;
    

    public int getRCLINKEDTOCOUNT() 
        return RCLINKEDTOCOUNT;
    

    public void setRCLINKEDTOCOUNT(int rCLINKEDTOCOUNT) 
        RCLINKEDTOCOUNT = rCLINKEDTOCOUNT;
    

    public int getRCRECTYPESECFILTER() 
        return RCRECTYPESECFILTER;
    

    public void setRCRECTYPESECFILTER(int rCRECTYPESECFILTER) 
        RCRECTYPESECFILTER = rCRECTYPESECFILTER;
    

    public int getRCAUTOPARTURI() 
        return RCAUTOPARTURI;
    

    public void setRCAUTOPARTURI(int rCAUTOPARTURI) 
        RCAUTOPARTURI = rCAUTOPARTURI;
    

    public String getSYSLASTUPDATED() 
        return SYSLASTUPDATED;
    

    public void setSYSLASTUPDATED(String sYSLASTUPDATED) 
        SYSLASTUPDATED = sYSLASTUPDATED;
    

    public int getRCORIGIN() 
        return RCORIGIN;
    

    public void setRCORIGIN(int rCORIGIN) 
        RCORIGIN = rCORIGIN;
    

    public String getRCDATEIMPORTED() 
        return RCDATEIMPORTED;
    

    public void setRCDATEIMPORTED(String rCDATEIMPORTED) 
        RCDATEIMPORTED = rCDATEIMPORTED;
    

    public String getRCSPURL() 
        return RCSPURL;
    

    public void setRCSPURL(String rCSPURL) 
        RCSPURL = rCSPURL;
    

    public String getRCSPGUID() 
        return RCSPGUID;
    

    public void setRCSPGUID(String rCSPGUID) 
        RCSPGUID = rCSPGUID;
    

    public String getRCSPFARMID() 
        return RCSPFARMID;
    

    public void setRCSPFARMID(String rCSPFARMID) 
        RCSPFARMID = rCSPFARMID;
    

    public String getRCSPLISTTYPE() 
        return RCSPLISTTYPE;
    

    public void setRCSPLISTTYPE(String rCSPLISTTYPE) 
        RCSPLISTTYPE = rCSPLISTTYPE;
    

    public String getRCSPSITECOLLID() 
        return RCSPSITECOLLID;
    

    public void setRCSPSITECOLLID(String rCSPSITECOLLID) 
        RCSPSITECOLLID = rCSPSITECOLLID;
    

    public int getRCMEDIATYPE() 
        return RCMEDIATYPE;
    

    public void setRCMEDIATYPE(int rCMEDIATYPE) 
        RCMEDIATYPE = rCMEDIATYPE;
    

    public int getRCFOLDERORIGIN() 
        return RCFOLDERORIGIN;
    

    public void setRCFOLDERORIGIN(int rCFOLDERORIGIN) 
        RCFOLDERORIGIN = rCFOLDERORIGIN;
    

    public int getRC1CAVEAT() 
        return RC1CAVEAT;
    

    public void setRC1CAVEAT(int rC1CAVEAT) 
        RC1CAVEAT = rC1CAVEAT;
    

    public int getRC2CAVEAT() 
        return RC2CAVEAT;
    

    public void setRC2CAVEAT(int rC2CAVEAT) 
        RC2CAVEAT = rC2CAVEAT;
    

    public int getRC3CAVEAT() 
        return RC3CAVEAT;
    

    public void setRC3CAVEAT(int rC3CAVEAT) 
        RC3CAVEAT = rC3CAVEAT;
    

    public int getRC4CAVEAT() 
        return RC4CAVEAT;
    

    public void setRC4CAVEAT(int rC4CAVEAT) 
        RC4CAVEAT = rC4CAVEAT;
    

    public int getRC5CAVEAT() 
        return RC5CAVEAT;
    

    public void setRC5CAVEAT(int rC5CAVEAT) 
        RC5CAVEAT = rC5CAVEAT;
    

    public int getRC6CAVEAT() 
        return RC6CAVEAT;
    

    public void setRC6CAVEAT(int rC6CAVEAT) 
        RC6CAVEAT = rC6CAVEAT;
    

    public int getRC7CAVEAT() 
        return RC7CAVEAT;
    

    public void setRC7CAVEAT(int rC7CAVEAT) 
        RC7CAVEAT = rC7CAVEAT;
    

    public int getRC8CAVEAT() 
        return RC8CAVEAT;
    

    public void setRC8CAVEAT(int rC8CAVEAT) 
        RC8CAVEAT = rC8CAVEAT;
    

    public int getSYSLASTUPDATEDBY() 
        return SYSLASTUPDATEDBY;
    

    public void setSYSLASTUPDATEDBY(int sYSLASTUPDATEDBY) 
        SYSLASTUPDATEDBY = sYSLASTUPDATEDBY;
    

    public int getRCSCHINACTIVECALC() 
        return RCSCHINACTIVECALC;
    

    public void setRCSCHINACTIVECALC(int rCSCHINACTIVECALC) 
        RCSCHINACTIVECALC = rCSCHINACTIVECALC;
    

    public String getRCSCHINACTIVE() 
        return RCSCHINACTIVE;
    

    public void setRCSCHINACTIVE(String rCSCHINACTIVE) 
        RCSCHINACTIVE = rCSCHINACTIVE;
    

    public String getRCDISPOSALKEY() 
        return RCDISPOSALKEY;
    

    public void setRCDISPOSALKEY(String rCDISPOSALKEY) 
        RCDISPOSALKEY = rCDISPOSALKEY;
    

    public String getRCSCHDISPOSALKEY() 
        return RCSCHDISPOSALKEY;
    

    public void setRCSCHDISPOSALKEY(String rCSCHDISPOSALKEY) 
        RCSCHDISPOSALKEY = rCSCHDISPOSALKEY;
    

    public int getRCSCHDISPCALC() 
        return RCSCHDISPCALC;
    

    public void setRCSCHDISPCALC(int rCSCHDISPCALC) 
        RCSCHDISPCALC = rCSCHDISPCALC;
    

    public String getRCHASLONGEVITYFMT() 
        return RCHASLONGEVITYFMT;
    

    public void setRCHASLONGEVITYFMT(String rCHASLONGEVITYFMT) 
        RCHASLONGEVITYFMT = rCHASLONGEVITYFMT;
    

    public String getRCHASREDACTABLEFMT() 
        return RCHASREDACTABLEFMT;
    

    public void setRCHASREDACTABLEFMT(String rCHASREDACTABLEFMT) 
        RCHASREDACTABLEFMT = rCHASREDACTABLEFMT;
    

    public String getRCHASOCRFMT() 
        return RCHASOCRFMT;
    

    public void setRCHASOCRFMT(String rCHASOCRFMT) 
        RCHASOCRFMT = rCHASOCRFMT;
    

    public int getRCCLIENTRECORD() 
        return RCCLIENTRECORD;
    

    public void setRCCLIENTRECORD(int rCCLIENTRECORD) 
        RCCLIENTRECORD = rCCLIENTRECORD;
    

    public int getRCMATTERRECORD() 
        return RCMATTERRECORD;
    

    public void setRCMATTERRECORD(int rCMATTERRECORD) 
        RCMATTERRECORD = rCMATTERRECORD;
    

    public int getRCCONSIGNMENTURI() 
        return RCCONSIGNMENTURI;
    

    public void setRCCONSIGNMENTURI(int rCCONSIGNMENTURI) 
        RCCONSIGNMENTURI = rCCONSIGNMENTURI;
    

    public int getRCAUTOCONFIDENCE() 
        return RCAUTOCONFIDENCE;
    

    public void setRCAUTOCONFIDENCE(int rCAUTOCONFIDENCE) 
        RCAUTOCONFIDENCE = rCAUTOCONFIDENCE;
    

    public String getRCDATESUPERSEDED() 
        return RCDATESUPERSEDED;
    

    public void setRCDATESUPERSEDED(String rCDATESUPERSEDED) 
        RCDATESUPERSEDED = rCDATESUPERSEDED;
    

    public String getRCDATERECEIVED() 
        return RCDATERECEIVED;
    

    public void setRCDATERECEIVED(String rCDATERECEIVED) 
        RCDATERECEIVED = rCDATERECEIVED;
    

    public String getRCGEOGRAPHY() 
        return RCGEOGRAPHY;
    

    public void setRCGEOGRAPHY(String rCGEOGRAPHY) 
        RCGEOGRAPHY = rCGEOGRAPHY;
    

    public String getRCNEEDSREVIEW() 
        return RCNEEDSREVIEW;
    

    public void setRCNEEDSREVIEW(String rCNEEDSREVIEW) 
        RCNEEDSREVIEW = rCNEEDSREVIEW;
    

    public String getRCNEEDSAUTHORIZATION() 
        return RCNEEDSAUTHORIZATION;
    

    public void setRCNEEDSAUTHORIZATION(String rCNEEDSAUTHORIZATION) 
        RCNEEDSAUTHORIZATION = rCNEEDSAUTHORIZATION;
    

    public int getRCAUTHORIZATIONMETHOD() 
        return RCAUTHORIZATIONMETHOD;
    

    public void setRCAUTHORIZATIONMETHOD(int rCAUTHORIZATIONMETHOD) 
        RCAUTHORIZATIONMETHOD = rCAUTHORIZATIONMETHOD;
    

    public int getRCREVIEWSTATE() 
        return RCREVIEWSTATE;
    

    public void setRCREVIEWSTATE(int rCREVIEWSTATE) 
        RCREVIEWSTATE = rCREVIEWSTATE;
    

    public String getRCREVIEWSTATEDATE() 
        return RCREVIEWSTATEDATE;
    

    public void setRCREVIEWSTATEDATE(String rCREVIEWSTATEDATE) 
        RCREVIEWSTATEDATE = rCREVIEWSTATEDATE;
    

    public String getRCREVIEWDUEDATE() 
        return RCREVIEWDUEDATE;
    

    public void setRCREVIEWDUEDATE(String rCREVIEWDUEDATE) 
        RCREVIEWDUEDATE = rCREVIEWDUEDATE;
    

    public int getRCACLGROUPKEY() 
        return RCACLGROUPKEY;
    

    public void setRCACLGROUPKEY(int rCACLGROUPKEY) 
        RCACLGROUPKEY = rCACLGROUPKEY;
    

    public int getRCACLCONTAINER() 
        return RCACLCONTAINER;
    

    public void setRCACLCONTAINER(int rCACLCONTAINER) 
        RCACLCONTAINER = rCACLCONTAINER;
    

    public int getRCACLEXCLUSION() 
        return RCACLEXCLUSION;
    

    public void setRCACLEXCLUSION(int rCACLEXCLUSION) 
        RCACLEXCLUSION = rCACLEXCLUSION;
    


5.pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.RecordDisposal</groupId>
    <artifactId>RecordDisposal</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>RecordDisposal</name>
    <description>RecordDisposal</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
               <groupId>org.apache.tomcat.embed</groupId>
               <artifactId>tomcat-embed-jasper</artifactId>
               <scope>provided</scope>
         </dependency>

         <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <scope>system</scope>
        <version>11.2.0.3</version>
        <systemPath>C:/Users/kqxk171/.m2/repository/ojdbc6/ojdbc6.jar</systemPath>
        </dependency> 

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            </dependency>



    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

6.Application.properties

#jsp
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

#oracle
spring.datasource.url=jdbc:oracle:thin:@"connection String of the database"
spring.datasource.username=trim
spring.datasource.password=qwerty123
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver


spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect

spring.datasource.dbcp2.initial-size=7
spring.datasource.dbcp2.max-total=20
spring.datasource.dbcp2.pool-prepared-statements=true

    错误信息

    原因:java.lang.IllegalArgumentException:不是托管类型:接口 RecordDisposal.dao.TSRecord

这是 oracle 表,我正在尝试在 JPA 中加载 enter image description here

【问题讨论】:

请edit您的问题并附上您尝试过的代码。这有助于其他读者回答您的问题。 【参考方案1】:

com.RecordDisposal.dao 下的 TSRecord 不是实体。

您可以尝试通过以下方式调整您的代码: RecordDisposalApplication.java:

package com.RecordDisposal;

...

@SpringBootApplication
@EnableJpaRepositories(basePackages = "com.RecordDisposal.dao")
public class RecordDisposalApplication

    public static void main(String[] args) 
    
        SpringApplication.run(RecordDisposalApplication.class, args);
    

TSRecordRepository.java

package com.RecordDisposal.dao;

...

@Repository
public interface TSRecordRepository extends JpaRepository<TSRecord, Long> 

【讨论】:

以上是关于在 Spring Boot 中加载现有的数据库(Oracle)表的主要内容,如果未能解决你的问题,请参考以下文章

尝试将 LowDB 与现有的 db.json 集成

如何通过Spring Boot在MongoDB中加载初始数据?

如何在 Spring Boot 中加入 SQL 表?

spring-boot使用Autowried还是Resouce

使用 Spring Boot 进行测试时仅从测试/资源中加载数据

内存数据库H2中的Spring Boot在初始化时不会从文件中加载数据