Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] List of enum in Entity (JPA2.0)?

Thank you very much for the pointer.

Regards,
Warren Tang <http://blog.tangcs.com>


On Saturday, October 29, 2011 2:31:46 AM, Christopher Delahunt wrote:

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)
    ...

--
Regards,
Warren Tang <http://blog.tangcs.com>


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top