mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 18:27:56 +08:00
- Assign ID in entity constructor
- Exclude entities from IEDA compiler to not erase enhancing
This commit is contained in:
parent
7edc5b7c66
commit
db16977236
4
cuba.ipr
4
cuba.ipr
@ -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)" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user