`
文章列表
Table per Class Strategy: the <union-class> element in Hibernate Single Table per Class Hierarchy Strategy: the <subclass> element in Hibernate Joined Subclass Strategy: the <joined-subclass> element in Hibernate ejb支持三种映射关系1,每个类一张表 (hibertnate里对应<union-class>)2,每个类层次一张表 (在 hi ...
主键类:定义为@Embeddable @Embeddablepublic class F {  private int id; private int id2; public int getId() {  return id; } public void setId(int id) {  this.id = id; } public int getId2() {  return id2; } public void setId2(int id2) {  this.id2 = id2; } }持久化类: @Entity@Table(name="E_USER",unique ...
例如:有三个类 A B C  最终要持久化的类是A 而 B C 都作为组件内在与A  B,C都要使用@Embeddable标注声明为一个组件   class A 代码:   @Entry public class A{ private int id; private B b; private C c; ... public B getB(){ ... } public C getC(){ .... } }  B 包含C class B @Embeddable public class B{ private Stirng b ...
hiberante sql映射对应   Java数据类型 Hibernate数据类型 标准SQL数据类型(PS:对于不同的DB可能有所差异) byte、java.lang.Byte byte TINYINT short、java.lang.Short short SMALLINT int、java.lang.Integer integer INGEGER long、java.lang.Long long BIGINT float、java.lang.Float float FLOAT double、java.lang.Doub ...
id生成:hibernate内不可使用的id生成器可见代码 使用@GeneratedValue1 正对不同的数据库可以同时使用        @Id        @GeneratedValue(strategy = GenerationType.AUTO)2 针对mysql @Id @GeneratedValue(strategy = GenerationType.IDENTITY)3 针对oracle       @Id       @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="s_gen") ...
为了追踪hibernate的信息 <property name="hibernate.show_sql">true</property>  新建User类:   @Entity @Table(name="E_USER",uniqueConstraints={ @UniqueConstraint(columnNames={"yahoo"}) }) public class User { private int id; private String yahoo; //昵称唯一@Id @GeneratedValu ...
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory  slf4j-api.jar, slf4j-nop.jar, 
转载请说明地址和作者   一,配置文件加载  1,Configuration        如果不是annoation则可以使用Configuration configuration = new Configuration();        使用annoation则可以使用Configuration configuration = new AnnotationConfiguration();   2,加载,使用onfiguration的configure方法根据方法参数可以有一下几种加载方式:        (1) configure();              吃方法会去 ...
1,iterator <s:iterator id="obj" value="list" status="index">     <!---输出当前元素的属性--> <s:property value="property"/>   <!---输出当前迭代元素的索引--> <s:property value="#index.index"/>   <!---输出当前迭代了几个元素--> <s:prope ...
网上有一个解答:    The reason was in JVM version. Platforms where deployment was successful used JVM 1.5 but problematical one had JVM 1.6. SAX2DOM class from Java 1.6 has a call to DocumentImpl::setXmlVersion() from its setDocumentInfo(). The version of xerces library I used doesn't have this method - it' ...

clob blob

        mysql   的机制其实应该是这样的:当你数据库缓存中的数据量达到tmp_table_size时,它会自动提交一次,然后继续接下来的操作,每tmp_table_size刷新数据库缓存    MySQL 中的 BLOB 数据由四种类型体现,分别是 TINYBLOB 其容量为 256 字节、BLOB 其容量为 64KB、MEDIUMBLOB 其容量为 16MB、LONGBLOB 其容量为 4GB。   CLOB类型默认为1m 如果大于的话可能会出现    Packet for query is too large (37748784 > 1048576). You c ...
1,输出到文件 java Hello.java > hello.txt 也可以>>吧内容附加到后面 2,integer各种toXXX方法:Integer.toBinaryString(2147483647);Integer.toHexString(2147483647);Integer.toOctalString(2147483647) 3,System.out.printf("%x%n", 19);System.out.printf("%o%n", 19);System.out.printf("%d%n", 19 ...
http://gceclub.sun.com.cn/Java_Docs/jdk6/html/zh_CN/api/java/util/ResourceBundle.html ResourceBundle类 ResourceBundle类主要作用是读取属性文件,读取属性文件时可以直接指定属性文件的名称(指定名称时不需要文件的后缀),也可以根据Locale所指定的区域码来选取指定的资源文件,ResourceBundle类的常用方法如表11-4所示。 表11-4  ResourceBundle类的常用方法 序号 方    法 类型
java.util.logging.Logger的使用 2009-07-22 20:13 1.在程序里面写死需要哪些log级别,使用哪些subscribe import java.util.logging.*;public class LoggingProgramSetPubSubpro {public static void main(String[] args) {    Logger logger = Logger.getLogger("loggingTest");   logger.setLevel(Level.INFO);//这个设定最重要     ...

拾遗补缺-date

    博客分类:
  • java
DateFormat 来格式化日期 2009年01月21日 星期三 18:19   public static void main(String[] args) {   Date date = new Date();   DateFormat dateFormat =new SimpleDateFormat("yyyy年MM月dd日EE");   System.out.println(dateFormat.format(date)); } ------------------------------------------------------------ ...
Global site tag (gtag.js) - Google Analytics