NutzCN Logo
问答 oracle查询sequence时,取到的结果总为初始值0
发布于 3009天前 作者 佐蓝 1958 次浏览 复制 上一个帖子 下一个帖子
标签:

通过 @SQL(value="select resourcedba.seq_itsm_relation.nextval FROM dual")取得的值不是当前序列的值,
无论执行多少次总是初始值0,有没有遇到过同样问题的

@Id(auto=false)
    @Prev({
        @SQL(value="select resourcedba.seq_itsm_relation.nextval FROM dual")
    })
	private int relationid;
	@Column("SRCID")
	private String source_ci_id;
	@Column("SRCSUBTYPECODE")
	private String source_ci_subtypecode;
	@Column("DSTID")
	private String target_ci_id;
	@Column("DSTSUBTYPECODE")
	private String target_ci_subtypecode;
	@Column("RELTYPE")
	private String rel_type;
	private String action;

	@XmlElement(name = "source_ci_id")
	public String getSource_ci_id() {
		return source_ci_id;
	}

	public void setSource_ci_id(String source_ci_id) {
		this.source_ci_id = source_ci_id;
	}

	@XmlElement(name = "source_ci_subtypecode")
	public String getSource_ci_subtypecode() {
		return source_ci_subtypecode;
	}

	public void setSource_ci_subtypecode(String source_ci_subtypecode) {
		this.source_ci_subtypecode = source_ci_subtypecode;
	}

	@XmlElement(name = "target_ci_id")
	public String getTarget_ci_id() {
		return target_ci_id;
	}

	public void setTarget_ci_id(String target_ci_id) {
		this.target_ci_id = target_ci_id;
	}

	@XmlElement(name = "target_ci_subtypecode")
	public String getTarget_ci_subtypecode() {
		return target_ci_subtypecode;
	}

	public void setTarget_ci_subtypecode(String target_ci_subtypecode) {
		this.target_ci_subtypecode = target_ci_subtypecode;
	}

	@XmlElement(name = "rel_type")
	public String getRel_type() {
		return rel_type;
	}

	public void setRel_type(String rel_type) {
		this.rel_type = rel_type;
	}

	@XmlElement(name = "Action")
	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

ALL Nutz Log via Log4jLogAdapter
2016-08-19 13:55:13,919 INFO  [main] Logs - Nutz is licensed under the Apache License, Version 2.0 .
Report bugs : https://github.com/nutzam/nutz/issues
2016-08-19 13:55:15,241 DEBUG [main] Scans - Locations for Scans:
[JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\nutz\nutz\1.b.53\nutz-1.b.53.jar], FileSystemResourceLocation [root=D:\JAVA\workspace\workspace8.0\nwims-data-loader], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-frontend-jaxws\3.0.8\cxf-rt-frontend-jaxws-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\ibm\icu\icu4j\2.6.1\icu4j-2.6.1.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\alibaba\fastjson\1.2.6\fastjson-1.2.6.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-ws-policy\3.0.8\cxf-rt-ws-policy-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-transports-http\3.0.8\cxf-rt-transports-http-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\alibaba\druid\1.0.14\druid-1.0.14.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-ws-addr\3.0.8\cxf-rt-ws-addr-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\jaxen\jaxen\1.1-beta-12\jaxen-1.1-beta-12.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-server\8.1.15.v20140411\jetty-server-8.1.15.v20140411.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xml-resolver\xml-resolver\1.2\xml-resolver-1.2.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-security\8.1.15.v20140411\jetty-security-8.1.15.v20140411.jar], FileSystemResourceLocation [root=D:\JAVA\eclipse\configuration\org.eclipse.osgi\383\0\.cp], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\bval\bval-jsr303\0.5\bval-jsr303-0.5.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-core\3.0.8\cxf-core-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\neethi\neethi\3.0.3\neethi-3.0.3.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-io\8.1.15.v20140411\jetty-io-8.1.15.v20140411.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xalan\xalan\2.6.0\xalan-2.6.0.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xerces\xmlParserAPIs\2.6.2\xmlParserAPIs-2.6.2.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\asm\asm\3.3.1\asm-3.3.1.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.11\jaxb-impl-2.2.11.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\wsdl4j\wsdl4j\1.6.3\wsdl4j-1.6.3.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\geronimo\specs\geronimo-servlet_3.0_spec\1.0\geronimo-servlet_3.0_spec-1.0.jar], FileSystemResourceLocation [root=D:\JAVA\workspace\workspace8.0\nwims-data-loader\target\classes], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-http\8.1.15.v20140411\jetty-http-8.1.15.v20140411.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar], FileSystemResourceLocation [root=D:\JAVA\eclipse\configuration\org.eclipse.osgi\382\0\.cp], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\commons-beanutils\commons-beanutils-core\1.8.3\commons-beanutils-core-1.8.3.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\edi\ediClient\2016-04-08\ediClient-2016-04-08.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\sun\xml\bind\jaxb-core\2.2.11\jaxb-core-2.2.11.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-continuation\8.1.15.v20140411\jetty-continuation-8.1.15.v20140411.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\junit\junit\4.11\junit-4.11.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-wsdl\3.0.8\cxf-rt-wsdl-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\eclipse\jetty\jetty-util\8.1.15.v20140411\jetty-util-8.1.15.v20140411.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xom\xom\1.0\xom-1.0.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-transports-http-jetty\3.0.8\cxf-rt-transports-http-jetty-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-bindings-xml\3.0.8\cxf-rt-bindings-xml-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\xerces\xercesImpl\2.6.2\xercesImpl-2.6.2.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\bval\bval-core\0.5\bval-core-0.5.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-frontend-simple\3.0.8\cxf-rt-frontend-simple-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\slf4j\slf4j-api\1.7.14\slf4j-api-1.7.14.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\jdom\jdom\1.0\jdom-1.0.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\com\oracle\ojdbc6\11.2.0.4.0\ojdbc6-11.2.0.4.0.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\ws\xmlschema\xmlschema-core\2.2.1\xmlschema-core-2.2.1.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-bindings-soap\3.0.8\cxf-rt-bindings-soap-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\cxf\cxf-rt-databinding-jaxb\3.0.8\cxf-rt-databinding-jaxb-3.0.8.jar], JarResourceLocation [jarPath=D:\Lab\bin\maven\.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar], FileSystemResourceLocation [root=D:\JAVA\workspace\workspace8.0\nwims-data-loader\target\test-classes]]
2016-08-19 13:55:15,667 DEBUG [main] Scans - Found 7 resource by src( . ) , regex( ^(.+[.])(js|json)$ )
2016-08-19 13:55:15,668 DEBUG [main] JsonLoader - loading ioc js config from [D:/JAVA/workspace/workspace8.0/nwims-data-loader/etc/db.js]
2016-08-19 13:55:15,672 DEBUG [main] JsonLoader - loading ioc js config from [D:/JAVA/workspace/workspace8.0/nwims-data-loader/src/main/resources/db.js]
2016-08-19 13:55:15,674 DEBUG [main] JsonLoader - loading ioc js config from [D:/JAVA/workspace/workspace8.0/nwims-data-loader/target/classes/db.js]
2016-08-19 13:55:15,674 DEBUG [main] JsonLoader - loading ioc js config from [D:/JAVA/workspace/workspace8.0/nwims-data-loader/target/classes/db.js]
2016-08-19 13:55:15,675 DEBUG [main] JsonLoader - Loaded 2 bean define from path=[.] --> [dataSource, dao]
2016-08-19 13:55:15,717 DEBUG [main] Scans - Found 182 resource by src( com/nari/nwims/ ) , regex( ^.+[.]class$ )
2016-08-19 13:55:15,865 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.bus.ITSMKPIMessageReceiver
2016-08-19 13:55:15,944 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.bus.ITSMKPIService
2016-08-19 13:55:15,979 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.biz.relation.service.ConfRelationService
2016-08-19 13:55:15,987 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.bus.ITSMKPIThread
2016-08-19 13:55:16,032 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.cache.Cache
2016-08-19 13:55:16,086 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.biz.relation.ws.ConfRelationSyncImpl
2016-08-19 13:55:16,091 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.biz.resource.service.ConfService
2016-08-19 13:55:16,155 DEBUG [main] AnnotationIocLoader - Found a Class with Ioc-Annotation : class com.nari.nwims.dataloader.biz.resource.ws.ConfSyncImpl
2016-08-19 13:55:16,216 DEBUG [main] Castors - Using 91 castor for Castors
2016-08-19 13:55:16,219 INFO  [main] AnnotationIocLoader - Scan complete ! Found 8 classes in 1 base-packages!
beans = ["cache", "confSyncImpl", "confService", "iTSMKPIThread", "confRelationSyncImpl", "iTSMKPIService", "iTSMKPIMessageReceiver", "confRelationService"]
2016-08-19 13:55:16,220 DEBUG [main] JsonLoader - Loaded 5 bean define from reader --
[txREPEATABLE_READ, txSERIALIZABLE, txNONE, txREAD_UNCOMMITTED, txREAD_COMMITTED]
2016-08-19 13:55:16,222 INFO  [main] NutIoc - NutIoc init begin ...
2016-08-19 13:55:16,224 INFO  [main] NutIoc - ... NutIoc init complete
2016-08-19 13:55:16,225 DEBUG [main] NutIoc - Get 'dao'<interface org.nutz.dao.Dao>
2016-08-19 13:55:16,225 DEBUG [main] NutIoc - 	 >> Load definition
2016-08-19 13:55:16,227 DEBUG [main] MapLoader - Loading define for name=dao
2016-08-19 13:55:16,230 DEBUG [main] ComboIocLoader - Found IocObject(dao) in IocLoader(JsonLoader@33224946)
2016-08-19 13:55:16,230 DEBUG [main] NutIoc - 	 >> Make...'dao'<interface org.nutz.dao.Dao>
2016-08-19 13:55:16,278 DEBUG [main] DefaultMirrorFactory - class org.nutz.dao.impl.NutDao without AOP
2016-08-19 13:55:16,278 DEBUG [main] ScopeContext - Save object 'dao' to [app] 
2016-08-19 13:55:16,280 DEBUG [main] NutIoc - Get 'dataSource'<>
2016-08-19 13:55:16,280 DEBUG [main] NutIoc - 	 >> Load definition
2016-08-19 13:55:16,280 DEBUG [main] MapLoader - Loading define for name=dataSource
2016-08-19 13:55:16,289 DEBUG [main] ComboIocLoader - Found IocObject(dataSource) in IocLoader(JsonLoader@33224946)
2016-08-19 13:55:16,289 DEBUG [main] NutIoc - 	 >> Make...'dataSource'<>
2016-08-19 13:55:16,315 DEBUG [main] DefaultMirrorFactory - class com.alibaba.druid.pool.DruidDataSource without AOP
2016-08-19 13:55:16,315 DEBUG [main] ScopeContext - Save object 'dataSource' to [app] 
2016-08-19 13:55:16,333 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,333 DEBUG [main] NutIoc - 	 >> Load definition
2016-08-19 13:55:16,333 DEBUG [main] MapLoader - Loading define for name=conf
2016-08-19 13:55:16,334 DEBUG [main] ComboIocLoader - Found IocObject(conf) in IocLoader(ExtConfLoader@23998265)
2016-08-19 13:55:16,335 DEBUG [main] NutIoc - 	 >> Make...'conf'<>
2016-08-19 13:55:16,335 DEBUG [main] DefaultMirrorFactory - class org.nutz.ioc.impl.PropertiesProxy without AOP
2016-08-19 13:55:16,336 DEBUG [main] ScopeContext - Save object 'conf' to [app] 
2016-08-19 13:55:16,340 INFO  [main] Scans - same resource path [/workspace8.0/nwims-data-loader/etc/db.properties](etc/db.properties/ D:\JAVA\workspace\workspace8.0\nwims-data-loader\.\etc\db.properties) will be override by [db.properties](D:\JAVA\workspace\workspace8.0\nwims-data-loader\.\etc\db.properties)
2016-08-19 13:55:16,340 DEBUG [main] Scans - Found 2 resource by src( .\etc\db.properties ) , regex( ^.+[.]properties$ )
2016-08-19 13:55:16,344 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,345 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,345 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,346 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,346 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,346 DEBUG [main] NutIoc - Get 'conf'<>
2016-08-19 13:55:16,347 DEBUG [main] NutIoc - Get 'dataSource'<>
2016-08-19 13:55:16,354 DEBUG [main] NutDao - NutDao[_selfId=0] init ...
2016-08-19 13:55:16,379 INFO  [main] NutFilePool - Init file-pool by: C:\Users\gu_renkai/.nutz/tmp/dao/ [200000]
2016-08-19 13:55:16,380 DEBUG [main] NutFilePool - file-pool.home: 'C:\Users\gu_renkai\.nutz\tmp\dao'
2016-08-19 13:55:16,380 INFO  [main] NutFilePool - file-pool.cursor: 0
2016-08-19 13:55:16,389 DEBUG [main] Jdbcs - Jdbcs init complete
2016-08-19 13:55:16,389 INFO  [main] Jdbcs - Get Connection from DataSource for JdbcExpert
2016-08-19 13:55:16,600 INFO  [main] DruidDataSource - {dataSource-1} inited
2016-08-19 13:55:17,025 DEBUG [main] DaoSupport$1 - JDBC Driver --> 11.2.0.4.0
2016-08-19 13:55:17,025 DEBUG [main] DaoSupport$1 - JDBC Name   --> Oracle JDBC driver
2016-08-19 13:55:17,026 DEBUG [main] DaoSupport$1 - JDBC URL    --> jdbc:oracle:thin:@10.20.32.66:1522:nwimscmdb
2016-08-19 13:55:17,028 DEBUG [main] DaoSupport - Database info --> ORACLE:[Oracle - Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options]
2016-08-19 13:55:17,118 DEBUG [main] NutDaoExecutor - INSERT INTO resourcedba.itsm_relation(relationid,SRCID,SRCSUBTYPECODE,DSTID,DSTSUBTYPECODE,RELTYPE) VALUES(?,?,?,?,?,?) 
    | 1 | 2 | 3 | 4 | 5 | 6 |
    |---|---|---|---|---|---|
    | 0 | 1 | 2 | 1 | 2 | 1 |
  For example:> "INSERT INTO resourcedba.itsm_relation(relationid,SRCID,SRCSUBTYPECODE,DSTID,DSTSUBTYPECODE,RELTYPE) VALUES(0,'1','2','1','2','1') "
2016-08-19 13:55:17,194 DEBUG [main] NutDaoExecutor - SQLException
java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件 (RESOURCEDBA.PK_ITSM_RELATION)

	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
	at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1046)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
	at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714)
	at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:266)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:81)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:264)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:64)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:219)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
	at org.nutz.dao.impl.NutDao.fastInsert(NutDao.java:188)
	at nwims.busdown.dataloader.biz.resource.service.test.testAdd(test.java:32)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

10 回复

有没有发现, @Prev看上去没有生效的样子

select resourcedba.seq_itsm_relation.nextval FROM dual

并没有打印出来

改成这样

@SQL(value="select resourcedba.seq_itsm_relation.nextval FROM dual", db=DB.ORACLE)

@wendal 加了 db=DB.ORACLE 之后 select resourcedba.seq_itsm_relation.nextval FROM dual 依然没有打印出来

是不是没编译?

来自炫酷的 NutzCN

@wendal

然编译之后
@Id(auto=false)
@Prev({@org.nutz.dao.entity.annotation.SQL(value="select resourcedba.seq_itsm_relation.nextval FROM dual", db=org.nutz.dao.DB.ORACLE)})
private int relationid;
应该是编译了的,刚把seq初始值改成1,发现还是0, 这个SQL成摆设了

换新版本试试

来自炫酷的 NutzCN

如果业务系统压力很大,建议使用oracle自带的触发器+序列事项自增长ID,否则会很慢。

@wendal @Wizzercn 感谢两位大大,换触发器可以了

后面检查出来,犯了个低级错误,没有set/get方法

添加回复
请先登陆
回到顶部