摘要: Hibernate 注解 没有加@Column一样会在数据库创建这些字段如下一个注解类:package com.hyy.hibernate.one_to_many.domain;import javax.persistence.*;/** * Created with IntelliJ IDEA. * User: HYY * Date: 13-11-28 * Time: 下午8:50 * To change this template use File | Settings | File Templates. */@Entity@Tablepublic class TypeToName { . 阅读全文
posted @ 2013-11-28 20:58 无忧之路 阅读(2560) 评论(0) 推荐(1) 编辑
摘要: ①纯Hibernate开发:当你在Bean中写入注解后,需要告诉hibernate哪些类使用了注解。方法是在hibernate.hbm.xml文件中配置 com.mysql.jdbc.Driver jdbc:mysql:///hibernatetest root 123 org.hibernate.dialect.MySQLDialect create ... 阅读全文
posted @ 2013-11-28 20:41 无忧之路 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 一个自增长ID的对象被save或者persist后,会返回其主键ID: Department department = new Department(); department.setName("xxxxxxx"); session.persist(department); System.out.println("id = " + department2.getId()); Department department2 = new Department(); department2.setName("xxxxx... 阅读全文
posted @ 2013-11-28 20:30 无忧之路 阅读(1714) 评论(0) 推荐(0) 编辑
摘要: 先看两个映射关系:部门: 员工: 测试类: //创建部门 Department department = new Department(); department.setName("dept"); department.setAddress(... 阅读全文
posted @ 2013-11-28 20:03 无忧之路 阅读(999) 评论(0) 推荐(0) 编辑
摘要: ①在src下添加两个文件:base_zh_CN.propertiesTest=\u8fd9\u662f\u4e2d\u6587base_en_US.propertiesTest=english②在src下添加一个测试类public class Guojihua { public static void main(String[] args) { Locale myLocale = Locale.getDefault();//获得系统默认的国家/语言环境 Locale en = new Locale("en","US"); ResourceBund... 阅读全文
posted @ 2013-11-28 11:37 无忧之路 阅读(265) 评论(0) 推荐(0) 编辑
无忧之路