Hibenate Facet / Entity Validation: How To?

Hello,

I'm having some problems regard entity validation made by the IDE, and the Hibernate Facet. My project is structured like this:

-> src/java/com/example/entities/User.java
@Entity
@Table(name = "users")
public class User implements Serializable {
@Column(name = "user_id")
private int id;

@Column(name = "user_name")
private String name;
}

-> src/resources/hibernate.cfg.xml
It is a regulara hibernate.cfg.xml, with the connection string settngs and the mapping tag for the User entity.

When I try to compile the project, it generates a series of errors pointing to Users.java, saying that "Cannot resolve table users" and similar errors for the columns. The error points to the @Table line.

My project's Module has a Hibenate Facet (automatically detected by the Project Wizard, by the way) where the "Descriptor Type" is "Hibernate configuration", with "Path" pointing to the hibernate.cfg.xml, and in "Datasources mapping", the column "Session factory" contains "Anonymous1 frmo hibernate.cfg.xml" and the column "Data source" is empty (I can't change anything as well).

That's how my project is configured, and these are the errors. Does anyone have an idea of how can I fix it? My environment is a Mac OSX 10.5, JDK 1.5.0_13, and IntelliJ IDEA 7.0.1 build #7364.

Thanks,
Rafael

1 comment

Hello Rafael,

the column "Session
factory" contains "Anonymous1 frmo hibernate.cfg.xml" and the column
"Data source" is empty (I can't change anything as well).


Try to define a data source (Main menu / Tools / Data sources) with tables
your classes refer to. Select this data source in Data source column of session
factories mapping table.


Thanks,
Rafael

Alexander.


0

Please sign in to leave a comment.