James Sherwood wrote: > > I still cannot find a good Tapestry-Hibernate tutorial though. I have a > rather large database created and would like to generate objects from > it(this tutorial is the other way around). >
Do you mean instead of just declaring an entity class and having hibernate create the table/schema for you, you want to write classes that are attached to pre-existing tables in your database? If so than you need to change a few settings, in hibernate.cfg.xml you need to change: <property name="hbm2ddl.auto">create</property> to <property name="hbm2ddl.auto">validate</property> This will stop hibernate from trying to create the schema and instead validate that you got the mappings between objects and tables correct. Next in your entity classes you now need to define which classes map to which tables and which fields map to which columns. This will work if you follow a certain naming scheme as well I believe (field userName maps to user_name) but if you want to do it explicitly here's how. Here's my ChatUser class which maps to table chat_user with a single column user @Entity @Table(name = "chat_user") @AccessType("field") public class ChatUser implements Serializable { private static final long serialVersionUID = 8828543828050669616L; @Id @Validate("required") private String userName; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } @Override public String toString() { return userName; } } Hope that helps -- View this message in context: http://www.nabble.com/T5%3A-Using-with-hibernate-and-Mysql-tp20166018p20173485.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]