hibernate入门(五)——关联映射

hibernate关联映射(注解) —— 多对一关联关系(@ManyToOne)
hibernate关联映射(注解) —— 一对多关联关系(@OneToMany)
hibernate关联映射(注解) —— 基于外键的双向一对一关联映射(@OneToOne)
hibernate关联映射(注解) —— 基于主键的双向一对一关联映射(@OneToOne)

待续。。。。。。。。。。。。。。。。。。。。。。。。

hibernate.cfg.xml




<hibernate-configuration>

    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driverproperty>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/demo_test?characterEncoding=UTF-8property>
        <property name="hibernate.connection.username">rootproperty>
        <property name="hibernate.connection.password">123456property>

        
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialectproperty>
        
        <property name="hibernate.show_sql">trueproperty>
        
        <property name="hibernate.format_sql">trueproperty>
        
        <property name="hibernate.hbm2ddl.auto">updateproperty>

        
        <property name="hibernate.current_session_context_class">threadproperty>

        
        <mapping class="demo.entity.User" />
        <mapping class="demo.entity.Group" />
        
    session-factory>

hibernate-configuration>

你可能感兴趣的:(hibernate)