读书人

一对多跟多对一双向关联

发布时间: 2012-08-26 16:48:06 作者: rapoo

一对多和多对一双向关联

一个组有多个用户 一个用户只能属于一个组 在用户表里面有组的外键

?

Annotation配置:

?

?

?

package com.zchen.hibernate;import org.hibernate.cfg.AnnotationConfiguration;import org.hibernate.tool.hbm2ddl.SchemaExport;import org.junit.Test;public class Snippet {@Testpublic void testSchemaExport(){new SchemaExport(new AnnotationConfiguration().configure()).create(true, true);}}

?

读书人网 >软件架构设计

热点推荐