hibernate_annotations http://hi.baidu.com/lyq32/blog/item/1a1b3c1f53c068cda7866901.html文档 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www2.matrix.org.cn/resource/article/2007-04-09/Hibernate+Annotations_62c034f4-e62a-11db-b1bd-fb5572962927.html 如果你在hibernate网站上下载了hibernate-annotations,比如hibernate-annotations-3.3.0.GA,那么在hibernate-annotations-3.3.0.GA\hibernate-annotations-3.3.0.GA\doc\reference\zh_cn\pdf下有一个中文的中文的annotation帮助文档1 applicationContext.xml中配置基于注释的sessionFactory <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hiberante.format_sql">true</prop> <!-- <prop key="hibernate.cache.provider_class"> org.hibernate.cache.EhCacheProvider </prop> --> </props> </property> <property name="annotatedClasses"> <list> <value>com.xxx.entity.User</value> <value>com.xxx.entity.Document</value> </list> </property> <property name="annotatedPackages"> <list> <value>com.xxx.entity</value> </list> </property> </bean>2 实体类的一对多多对已关系的简单例子如下:@Entity@Table(name = "Users")public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String code; @OneToMany(mappedBy="author",cascade=CascadeType.ALL) private Collection<Document> documents; get/set...... ......}@Entity@Table(name="Documents")public class Document { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String caption; @ManyToOne @JoinColumn(name="author_id",referencedColumnName="id") private User author; get/set...... ......} http500是什么错误 checkbox怎样连接到文件? log4j简单问题 急 [精彩推荐]带您一起了解Web 2.0 请教一个问题,hibernate多对一单向映射 急急急!每道题的ABCD选项为一组radio,如何在另外一个页面获取到底选中的radio. 在线等! jsp 编译错误:cannot resolve symbol: class DbConnection 求一个简单的jsp+ORACLE的分页程序 solaris下上传中文件乱码 想请大家帮忙,望各位能给我指点迷津!! eclipse下编辑web.xml文件速度很慢 求解:struts中tiles框架和form表单能共用吗?
hibernate-annotations-3.3.0.GA\hibernate-annotations-3.3.0.GA\doc\reference\zh_cn\pdf下有一个中文的中文的annotation帮助文档1 applicationContext.xml中配置基于注释的sessionFactory
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hiberante.format_sql">true</prop>
<!-- <prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop> -->
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.xxx.entity.User</value>
<value>com.xxx.entity.Document</value>
</list>
</property>
<property name="annotatedPackages">
<list>
<value>com.xxx.entity</value>
</list>
</property>
</bean>
2 实体类的一对多多对已关系的简单例子如下:
@Entity
@Table(name = "Users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String code;
@OneToMany(mappedBy="author",cascade=CascadeType.ALL)
private Collection<Document> documents;
get/set......
......
}@Entity
@Table(name="Documents")
public class Document {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String caption;
@ManyToOne
@JoinColumn(name="author_id",referencedColumnName="id")
private User author;
get/set......
......
}