NutzCN Logo
问答 第一次使用Nutz,哪位有与miniui结合经验的仁兄,分享一下前台和后台的一套代码,基本的分页查询啊什么的都可以
发布于 2376天前 作者 wx_nvu0j53rdpc0ebqbi0kc 1718 次浏览 复制 上一个帖子 下一个帖子
标签:

求分享!!!新人求罩

13 回复

你写一个就有了

等我写出来 分享出来

@wendal 项目数据库还在搭建,目前只是在大概走下开发流程,代码走到最后,为啥报这个错?是没有数据库的原因吗?

org.nutz.dao.DaoException: java.sql.SQLException: 仅 READ_COMMITTED 和 SERIALIZABLE 是有效的事务处理级
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.NutDao.query(NutDao.java:482)
	at com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage.listIssuedDefine(SsProjectManage.java:158)
	at com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage$$NUTZAOP._aop_invoke(SsProjectManage.java:11)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.wonders.framework.common.interceptor.LoggerInterceptor.filter(LoggerInterceptor.java:40)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.wonders.biz.fl.fljg.xmgl.ssxm.manage.SsProjectManage$$NUTZAOP.listIssuedDefine(SsProjectManage.java:1)
	at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt.queryQuotaAllotList(SsProjectAt.java:45)
	at com.wonders.biz.fl.fljg.xmgl.ssxm.at.SsProjectAt$FM$queryQuotaAllotList$6baebada686c77d039bebedad425be41.invoke(SsProjectAt.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: 仅 READ_COMMITTED 和 SERIALIZABLE 是有效的事务处理级
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
	at oracle.jdbc.driver.PhysicalConnection.setTransactionIsolation(PhysicalConnection.java:1607)
	at org.apache.commons.dbcp.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:380)
	at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setTransactionIsolation(PoolingDataSource.java:343)
	at org.nutz.trans.NutTransaction$ConnInfo.<init>(NutTransaction.java:32)
	at org.nutz.trans.NutTransaction.getConnection(NutTransaction.java:92)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:100)
	... 53 more

代码有毛病木(可怜)

 @At
    @Ok("json")
    public Object queryQuotaAllotList(@Param("year")String year,@Param("region")String region,@Param("quotaName")String quotaName, @Param("..")Pager pager){

        return ssProjectManage.listIssuedDefine(year,region,quotaName,pager);
    }
    public QueryResult listIssuedDefine(String year, String region, String quotaName, Pager pager){
        Cnd cnd = Strings.isBlank(year)? null : Cnd.where("year","=","year");
        cnd = Strings.isBlank(region)? null : Cnd.where ("region","=","region");
        cnd = Strings.isBlank(region)? null : Cnd.where ("quotaName","=","quotaName");
        QueryResult qr = new QueryResult();
        qr.setList(dao.query(DfjgQuotaAllotDO.class,cnd,pager));
        pager.setRecordCount(dao.count(DfjgQuotaAllotDO.class,cnd));
        qr.setPager(pager);
        return qr;
    }

配了aop事务,然后事务级别不被oracle支持

@wendal 说的有点高深,不是代码问题吧,数据库配置方面的问题?:)

@wendal 这段不太理解作用,我再看看API,不过API里面好像没有具体的注释

var ioc = {
	$aop : {
		type : 'org.nutz.ioc.aop.config.impl.ComboAopConfigration',
		fields : {
			aopConfigrations : [{
				type : 'org.nutz.ioc.aop.config.impl.JsonAopConfigration',
				fields : {
					itemList : [
						["com.wonders.","^.*[Manage]$","ioc:logger"],
						["com.wonders..+Manage$", "(add|insert).+", "ioc:txREAD_COMMITTED"],
		                ["com.wonders..+Manage$", "(save|update|delete|remove|clear).", "ioc:txSERIALIZABLE"],
		                ["com.wonders..+Manage$", "(get|query|find|fetch|list|load).+", "ioc:txNONE"],
		                ["com.wonders..+Module$", ".+", "txREAD_COMMITTED"],
					]
				}
			}, {
				type : 'org.nutz.ioc.aop.config.impl.AnnotationAopConfigration'
			}]
		}
	},
	txNONE : {
		type : 'org.nutz.aop.interceptor.TransactionInterceptor',
		args : [ 0 ]
	},
	txREAD_UNCOMMITTED : {
		type : 'org.nutz.aop.interceptor.TransactionInterceptor',
		args : [ 1 ]
	},
	txREAD_COMMITTED : {
		type : 'org.nutz.aop.interceptor.TransactionInterceptor',
		args : [ 2 ]
	},
	txREPEATABLE_READ : {
		type : 'org.nutz.aop.interceptor.TransactionInterceptor',
		args : [ 4 ]
	},
	txSERIALIZABLE : {
		type : 'org.nutz.aop.interceptor.TransactionInterceptor',
		args : [ 8 ]
	},	
	log : {
		type : 'org.nutz.aop.interceptor.LoggingMethodInterceptor'
	}
};
["com.wonders..+Manage$", "(get|query|find|fetch|list|load).+", "ioc:txNONE"],

删掉

@wendal 求问 这段啥意思((*╹▽╹*)),感谢耐心解答

看文档,好像是对类的事务拦截。

var ioc = {
    $aop : {
        type : "org.nutz.ioc.aop.config.impl.JsonAopConfigration",
        fields : {
            itemList : [
                //[类名的正则表达式,方法名的正则表达式,事务拦截器名称] 事务拦截器的名称请看TransAop类
                ["net.wendal.nutzcn.servie..+Service$", "^save.+", "txREAD_COMMITTED"],
                ["net.wendal.nutzcn.servie..+Service$", "^query.+", "txNONE"],
                ["net.wendal.nutzcn.servie..+Service$", "^update.+", "txSERIALIZABLE"],
                ["net.wendal.nutzcn.module..+Module$", ".+", "txREAD_COMMITTED"],
            ]
        }
    }
}
添加回复
请先登陆
回到顶部