java积累经验

错误:找不到  (sqlQuery) 这个属性

org.springframework.orm.hibernate3.HibernateSystemException: Named query not known: sqlQuery; nested exception is org.hibernate.MappingException: Named query not known: sqlQuery

解决方法:放在 (class)标签下面

</class>
<sql-query name="sqlQuery">
<![CDATA[select * from t_user u ]]>
<returnalias="tuser"class="cn.ffcs.rapid.model.Tuser"></return></sql-query>



错误:
Causedby:java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException


解决:JDK版本不够



错误:交易未成功启动(由spring来管理实务控制)

org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Transaction not successfully started

解决:不需要自己来开启事物和提交事物(
Transaction transaction=session.beginTransaction();
transaction.commit();




错误:EL  表达式中可用表达式
["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"]


错误:org.springframework.orm.hibernate3.HibernateSystemException: this id generator generates long, integer, short;

解决:Model 更换主键生成策略
@Id @GeneratedValue(generator="custom-id")
@GenericGenerator(name="custom-id", strategy = "increment")


错误:ids for this class must be manually assigned before calling save(): com.zldigital.bond.model.Entgrade; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.zldigital.bond.model.Entgrade

解决:复合主键为空!


错误: tag 'select', field 'list', name 'clientnature': The requested list key 'listnatureData' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

解决:Jsp 页面status2标签不能直接获取action中list


错误: org.springframework.orm.hibernate3.HibernateQueryException: entproject is not mapped [ from entproject where status=24]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: entproject is not mapped [ from entproject where status=24]

解决:from entproject where status=24 表名改为对象名称
from Entproject where status=24


错误:Got error 139 from storage engine
解决:mysql 数据 innodb的单条记录最大只能到8000字节,超长就会出错 ,换成MyISAM

你可能感兴趣的:(java)