I'm somewhat new to IntelliJ but am really liking it so far. I'm having an issue, though, with mapping an enumerated element collection in my class.
When I build and run my code on my server (Wildfly 8.0.0), everything works out fine, and the database populates correctly when I persist entities. If I remove the line
<column name="role"/> from my last mapping, I get an error on my server when trying to persist a User entity. When I add the aforementioned line, everything works properly. However, Intellij complains
Cannot resolve column 'role' And when I type that line and pause for IntelliJ to suggest a column name, it suggests all of the columns in my Users table, which is not the mapping I need.
Is there a way to at least have IntelliJ ignore this error, if not resolve it?
Using
- Intellij 1.5.0.2
- hibernate-jpa-2.1-api-1.0.0.Final
- hibernate-core-4.3.1.Final
Using XML mapping for this class:
public class User { private Long id; private String firstname; private String lastname; private String email; private String phone; private List<Role> roles = new LinkedList<Role>(); ...getters and setters... } With this mapping:
<entity class="User"> <table name="Users"/> <attributes> <id name="id"> <column name="user_id"/> <generated-value strategy="TABLE" generator="idGenerator"/> </id> <basic name="firstname"> <column name="user_firstname"/> </basic> <basic name="lastname"> <column name="user_lastname"/> </basic> <basic name="email"> <column name="user_email"/> </basic> <basic name="phone"> <column name="user_phone"/> </basic> <element-collection name="roles" target-class="com.package.Role"> <column name="role"/> /* INTELLIJ ERRORS AT role */ <enumerated>STRING</enumerated> <collection-table name="Roles"> <join-column name="user_id"/> </collection-table> </element-collection> </attributes> </entity>
No comments:
Post a Comment