2014年1月12日

Hibernate component mapping

摘要: A Component is a containted object that is be persisted value type and not an entity.But you canembedthe component to entity.Now We need one-to-one association for husband an wife. We just let the in one table. Then we create one entity, on component.such as this:Entity Husband: 1 @Entity 2 public c 阅读全文
posted @ 2014-01-12 11:39 andyOS 阅读(256) 评论(0) 推荐(0)
2014年1月11日

Hibernate -- A unidirectional one-to-one association on a foreign key

摘要: at sometime we usually need to create two tables that one table relate another.Such as a husband onlyhave a wife. So how can I design relationship like this.In programming, The type of this relationshipnamed “unidirectional one-to-one association”.How to implement this relationship with hibernate?ex 阅读全文
posted @ 2014-01-11 15:17 andyOS 阅读(382) 评论(0) 推荐(0)

Use Hibernate core API

摘要: For Hibernate configuration, We can use hibernate.cfg.xml file to configure: 1 2 5 6 7 8 9 10 11 org.hsqldb.jdbcDriver12 jdbc:hsqldb:hsql://localhost13 sa14 15 16 17 118 19 20 org.hibernate.dialect.HSQLDialect21 22 ... 阅读全文
posted @ 2014-01-11 00:54 andyOS 阅读(442) 评论(0) 推荐(0)

Hibernate Id Generator and Primary Key

摘要: Use automate id by hibernate:If you want the tables' id be created automation. How to do it?When use XML file, Just use the generator: 1 2 3 4 5 Now id whichis named id will be created automation. The class native can automatically identify Database you use.You can also use uuid or hilo to get . 阅读全文
posted @ 2014-01-11 00:53 andyOS 阅读(439) 评论(0) 推荐(0)