- Assign ID in entity constructor

- Exclude entities from IEDA compiler to not erase enhancing
This commit is contained in:
Konstantin Krivopustov 2008-12-10 07:52:59 +00:00
parent 7edc5b7c66
commit db16977236
4 changed files with 10 additions and 7 deletions

View File

@ -57,6 +57,10 @@
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="DEPLOY_AFTER_MAKE" value="0" />
<excludeFromCompile>
<directory url="file://$PROJECT_DIR$/modules/core/src/com/haulmont/cuba/core/entity" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/modules/core/src/com/haulmont/cuba/security/entity" includeSubdirectories="true" />
</excludeFromCompile>
<resourceExtensions>
<entry name=".+\.(properties|xml|html|dtd|tld)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />

View File

@ -33,6 +33,10 @@ public class BaseUuidEntity implements BaseEntity<UUID>
@Column(name = "CREATED_BY", length = PersistenceProvider.LOGIN_FIELD_LEN)
private String createdBy;
public BaseUuidEntity() {
id = UuidProvider.createUuid();
}
public UUID getId() {
return id;
}

View File

@ -26,8 +26,7 @@ public class PersistenceTest extends CubaTestCase
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = UuidProvider.createUuid();
server.setId(id);
id = server.getId();
server.setName("localhost");
server.setAddress("127.0.0.1");
server.setRunning(true);

View File

@ -28,25 +28,21 @@ public class UserRoleTest extends CubaTestCase
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
User user = new User();
UUID userId = UuidProvider.createUuid();
user.setId(userId);
UUID userId = user.getId();
user.setLogin("testUser1");
user.setName("Test User 1");
em.persist(user);
Role role = new Role();
role.setId(UuidProvider.createUuid());
role.setName("testRole1");
em.persist(role);
Profile profile = new Profile();
profile.setId(UuidProvider.createUuid());
profile.setName("testProfile");
profile.setUser(user);
em.persist(profile);
ProfileRole profileRole = new ProfileRole();
profileRole.setId(UuidProvider.createUuid());
profileRole.setProfile(profile);
profileRole.setRole(role);
em.persist(profileRole);