Fix JPA problem

This commit is contained in:
Calvin
2012-02-29 00:06:29 +08:00
parent dd11e792ad
commit 7a230ae196
6 changed files with 3 additions and 30 deletions
+1 -3
View File
@@ -8,9 +8,7 @@ TODO部分:
* 引入Profile管理環境
* 用Spring Data JPA代替BaseDao基类,清理Hibernate基类及相关
--GroupDao
--checkunique
--Column Naming (loginName)
--testcase, hibernateMapping
--same thing as hibernateMapping?
2.次要改动
@@ -43,7 +43,7 @@ public class User extends IdEntity {
private List<Group> groupList = Lists.newArrayList();//有序的关联对象集合
//字段非空且唯一, 用于提醒Entity使用者及生成DDL.
@Column(name = "LOGIN_NAME", nullable = false, unique = true)
@Column(nullable = false, unique = true)
public String getLoginName() {
return loginName;
}
@@ -72,18 +72,6 @@ public class AccountManager {
return userDao.findByLoginName(loginName);
}
/**
* 检查用户名是否唯一.
*
* @return newLoginName在数据库中唯一或等于oldLoginName时返回true.
*/
@Transactional(readOnly = true)
public boolean isLoginNameUnique(String newLoginName, String oldLoginName) {
return true;
//TODO
//return userDao.isPropertyUnique("loginName", newLoginName, oldLoginName);
}
//-- Group Manager --//
@Transactional(readOnly = true)
public Group getGroup(Long id) {
@@ -1,11 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
! (c) Copyright 2005-2012 JAXIO, www.jaxio.com
! Source code generated by Celerio, a Jaxio product
! Want to use Celerio within your company? email us at info@jaxio.com
! Follow us on twitter: @springfuse
! Template pack-backend-sd:src/main/resources/META-INF/orm.p.vm.xml
-->
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm/orm_2_0.xsd" version="2.0">
</entity-mappings>
@@ -1,11 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
! (c) Copyright 2005-2012 JAXIO, www.jaxio.com
! Source code generated by Celerio, a Jaxio product
! Want to use Celerio within your company? email us at info@jaxio.com
! Follow us on twitter: @springfuse
! Template pack-backend-sd:src/main/resources/META-INF/persistence.p.vm.xml
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="miniwebPU" transaction-type="RESOURCE_LOCAL">
@@ -30,6 +30,7 @@
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache/ehcache-hibernate-local.xml</prop>
<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
</props>
</property>
</bean>