The error is because permisions is defaulting use a field called
"PERMISSIONS" in the database.
You will need to specify the @CollectionTable and @ElementCollection
if you need it to go to a table like your ManyToMany would have.
Best Regards
Chris.
On 28/10/2011 11:37 AM, Warren Tang wrote:
Hi,
I just change the Permission class from an entity to enum for
simplicity, but it causes errors (the partial stack trace is at
the end).
Is it supported?
@Entity
public class Role {
public static final String NORMAL_ROLE = "normal";
public static final String ADMIN_ROLE = "admin";
public static final String QUERY_SELECT_ALL = "select r from
Role r";
@Id
private String id;
private String name;
//@ManyToMany(cascade = {CascadeType.ALL})
List<Permission> permissions;
...
}
ERROR:
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904:
"PERMISSIONS": invalid identifier
Error Code: 904
Call: SELECT ID, NAME, PERMISSIONS FROM ROLE WHERE (ID = ?)
bind => [normal]
Query: ReadObjectQuery(name="readObject" referenceClass=Role
sql="SELECT ID, NAME, PERMISSIONS FROM ROLE WHERE (ID = ?)")
at
org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
...
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|