提示:hbernate 4.1之后对于HQL中查询参数的占位符做了改进。
改进前代码:
String hql = "select t from Blog t where t.site=?";
query.setParameter(0, "micmiu.com");
改进后代码:
String hql2 = "select t from Blog t where t.site=:site";
query2.setParameter("site", "micmiu.com");
改进前代码:
String hql = "select t from Blog t where t.site=?";
query.setParameter(0, "micmiu.com");
改进后代码:
String hql2 = "select t from Blog t where t.site=:site";
query2.setParameter("site", "micmiu.com");
2016-02-26
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
还有<property name="connection.password">zxcvbn</property>这一栏填好自己数据库的密码比如我的数据库密码为zxcvbn
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
还有<property name="connection.password">zxcvbn</property>这一栏填好自己数据库的密码比如我的数据库密码为zxcvbn
弄了一下午才把测试的表在数据库里生成,为了帮助一些还有错误的伙伴,我把几个注意的点说明下:本人用的是MyEclipse,最好还是把包导入到lib里,千万注意那3个xml文件的头部。。我前面是手敲的,出了各种问题。。。。。
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
请接着看下面,还有一部分
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
请接着看下面,还有一部分
楼上的考虑有偏颇。不管你设置的SID有多少位数字,在逻辑上都会有上限。身份证上同年同月同日的还只有9999个,更何况是一跟学校?程序开发解决的是实际的需求,而不是逻辑的严谨。如果你明明搭建的是一个校内网环境,你非要考虑用户过亿的情况,那肯定是脑袋秀逗了。
2016-02-05
警告: Could not find action or result
No result defined for action com.l2qq.action.UserAction and result input
No result defined for action com.l2qq.action.UserAction and result input
2016-01-31