OpenSuse 11.3
java version "1.6.0_20"
eclipselink 2.1.1
Hi,
I'm using @ElementCollection annotation to persist some strings list:
@ElementCollection
@CollectionTable(
name="shiro_role_permission",
joinColumns=@JoinColumn(name="ROLE_ID",referencedColumnName="ID"))
@Column(name="permission")
private Set<String> permissions;
Executing my tests I'm getting this exception with DBunit:
Testcase: org.apache.click.extras.security.shiro.UserJpaTest: Caused an ERROR
SHIRO_ROLE_PERMISSION
org.dbunit.dataset.NoPrimaryKeyException: SHIRO_ROLE_PERMISSION at org.dbunit.operation.DeleteOperation.getOperationData(DeleteOperation.java:81) at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:170) at org.apache.click.extras.security.shiro.UserJpaTest.closeEntityManager(UserJpaTest.java:69) at org.dbunit.operation.DeleteOperation.getOperationData(DeleteOperation.java:81)
Activating the eclipselink log I've found that the TABLE has not primary key:
[EL Config]: 2010-09-06 13:01:32.01--ServerSession(22730182)--Connection(13948523)--Thread(Thread[main,5,main])--Connected: jdbc:h2:mem
User: CLICK
Database: H2 Version: 1.2.131 (2010-03-05)
Driver: H2 JDBC Driver Version: 1.2.131 (2010-03-05)
[EL Info]: 2010-09-06 13:01:32.482--ServerSession(22730182)--Thread(Thread[main,5,main])--file:/home/gilberto/dev/netbeans-config/coi/orm/target/test-classes/_click login successful
[EL Fine]: 2010-09-06 13:01:32.541--ServerSession(22730182)--Connection(13599389)--Thread(Thread[main,5,main])--CREATE TABLE shiro_user_role (user_id BIGINT NOT NULL, role_id BIGINT NOT NULL, PRIMARY KEY (user_id, role_id))
[EL Fine]: 2010-09-06 13:01:32.605--ServerSession(22730182)--Connection(13599389)--Thread(Thread[main,5,main])--CREATE TABLE shiro_role_permission (ROLE_ID BIGINT NOT NULL, permission VARCHAR)
[EL Fine]: 2010-09-06 13:01:32.608--ServerSession(22730182)--Connection(13599389)--Thread(Thread[main,5,main])--CREATE TABLE shiro_role (ID BIGINT NOT NULL, DESCRIPTION VARCHAR(255), NAME VARCHAR(50) NOT NULL, PRIMARY KEY (ID))
Is it the default behavior? Can I change it?
Regards,
Gilberto
[Updated on: Mon, 06 September 2010 16:05]
Report message to a moderator