Hibernate SVN: r10509 - trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 17:10:01 -0400 (Thu, 21 Sep 2006)
New Revision: 10509
Added:
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Student.java
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Teacher.java
Log:
test showing massive cascading
Added: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java 2006-09-21 14:41:33 UTC (rev 10508)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java 2006-09-21 21:10:01 UTC (rev 10509)
@@ -0,0 +1,66 @@
+//$Id: FetchTest.java 9796 2006-04-26 06:46:52Z epbernard $
+package org.hibernate.ejb.test.cascade;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.ejb.test.TestCase;
+
+
+/**
+ * @author Max Rydahl Andersen
+ */
+public class CascadeTest extends TestCase {
+
+ public void testCascade() throws Exception {
+
+ EntityManager em = factory.createEntityManager();
+ em.getTransaction().begin();
+
+ Teacher teacher = null;
+
+ teacher = new Teacher();
+
+ Student student = new Student();
+
+ teacher.setFavoriteStudent(student);
+ student.setFavoriteTeacher(teacher);
+
+ teacher.getStudents().add(student);
+ student.setPrimaryTeacher(teacher);
+
+ em.persist( teacher );
+ em.getTransaction().commit();
+
+ System.out.println("***************************");
+ em = factory.createEntityManager();
+ em.getTransaction().begin();
+
+ Teacher foundTeacher = (Teacher) em.createQuery( "select t from Teacher as t" ).getSingleResult();
+
+ System.out.println(foundTeacher);
+ System.out.println(foundTeacher.getFavoriteStudent());
+
+ for (Student fstudent : foundTeacher.getStudents()) {
+ System.out.println(fstudent);
+ System.out.println(fstudent.getFavoriteTeacher());
+ System.out.println(fstudent.getPrimaryTeacher());
+ }
+
+ em.getTransaction().commit(); // here *alot* of flushes occur on an object graph that has *Zero* changes.
+ em.close();
+
+
+ }
+
+
+ public Class[] getAnnotatedClasses() {
+ return new Class[]{
+ Teacher.class,
+ Student.class
+ };
+ }
+
+
+}
Added: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Student.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Student.java 2006-09-21 14:41:33 UTC (rev 10508)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Student.java 2006-09-21 21:10:01 UTC (rev 10509)
@@ -0,0 +1,57 @@
+package org.hibernate.ejb.test.cascade;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+
+import org.hibernate.annotations.AccessType;
+
+@Entity
+@AccessType("field")
+public class Student {
+
+ @Id @GeneratedValue
+ Long id;
+
+ String name;
+
+ @ManyToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST})
+ private Teacher primaryTeacher;
+
+ @OneToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST})
+ private Teacher favoriteTeacher;
+
+ public Student() {
+ }
+
+ public Teacher getFavoriteTeacher() {
+ return favoriteTeacher;
+ }
+
+ public void setFavoriteTeacher(Teacher lifeCover) {
+ this.favoriteTeacher = lifeCover;
+ }
+
+ public Teacher getPrimaryTeacher() {
+ return primaryTeacher;
+ }
+
+ public void setPrimaryTeacher(Teacher relativeTo) {
+ this.primaryTeacher = relativeTo;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Teacher.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Teacher.java 2006-09-21 14:41:33 UTC (rev 10508)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Teacher.java 2006-09-21 21:10:01 UTC (rev 10509)
@@ -0,0 +1,62 @@
+package org.hibernate.ejb.test.cascade;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+
+import org.hibernate.annotations.AccessType;
+
+@Entity
+@AccessType("field")
+public class Teacher {
+
+ @Id @GeneratedValue
+ Long id;
+
+ String name;
+
+ @OneToMany(mappedBy="primaryTeacher", cascade={CascadeType.MERGE, CascadeType.PERSIST})
+ private Set<Student> students = new HashSet<Student>();
+
+ @OneToOne(mappedBy="favoriteTeacher", cascade={CascadeType.MERGE, CascadeType.PERSIST})
+ private Student favoriteStudent;
+
+ public Teacher() {
+ }
+
+ public Student getFavoriteStudent() {
+ return favoriteStudent;
+ }
+
+ public void setFavoriteStudent(
+ Student contributionOrBenefitParameters) {
+ this.favoriteStudent = contributionOrBenefitParameters;
+ }
+
+ public Set<Student> getStudents() {
+ return students;
+ }
+
+ public void setStudents(
+ Set<Student> todoCollection) {
+ this.students = todoCollection;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
18 years, 2 months
Hibernate SVN: r10508 - branches
by hibernate-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2006-09-21 10:41:33 -0400 (Thu, 21 Sep 2006)
New Revision: 10508
Added:
branches/DOC_TRANSLATION_3_2/
Log:
Branch for RHAT documentation team
Copied: branches/DOC_TRANSLATION_3_2 (from rev 10507, trunk/Hibernate3/doc/reference)
18 years, 2 months
Hibernate SVN: r10506 - in trunk/HibernateExt/tools/src/test/org/hibernate/tool: . stat
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:50:54 -0400 (Thu, 21 Sep 2006)
New Revision: 10506
Added:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/Group.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/SessionAttribute.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/StatisticsBrowserTest.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/User.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/UserGroup.hbm.xml
Log:
HBX-759
basic test class for testing browser
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/Group.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/Group.java 2006-09-21 06:48:20 UTC (rev 10505)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/Group.java 2006-09-21 06:50:54 UTC (rev 10506)
@@ -0,0 +1,35 @@
+//$Id: Group.java 5686 2005-02-12 07:27:32Z steveebersole $
+package org.hibernate.tool.stat;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class Group {
+ private String name;
+ private Set users = new HashSet();
+ Group() {}
+ public Group(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Set getUsers() {
+ return users;
+ }
+ public void setUsers(Set users) {
+ this.users = users;
+ }
+ public void addUser(User user) {
+ users.add(user);
+
+ }
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/SessionAttribute.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/SessionAttribute.java 2006-09-21 06:48:20 UTC (rev 10505)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/SessionAttribute.java 2006-09-21 06:50:54 UTC (rev 10506)
@@ -0,0 +1,38 @@
+//$Id: SessionAttribute.java 5686 2005-02-12 07:27:32Z steveebersole $
+package org.hibernate.tool.stat;
+
+import java.io.Serializable;
+
+/**
+ * @author Gavin King
+ */
+public class SessionAttribute {
+ private Long id;
+ private String name;
+ private String stringData;
+
+ SessionAttribute() {}
+ public SessionAttribute(String name) {
+ this.name = name;
+ }
+ public SessionAttribute(String name, String str) {
+ this.name = name;
+ this.stringData = str;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getStringData() {
+ return stringData;
+ }
+ public void setStringData(String stringData) {
+ this.stringData = stringData;
+ }
+
+ public Long getId() {
+ return id;
+ }
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/StatisticsBrowserTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/StatisticsBrowserTest.java 2006-09-21 06:48:20 UTC (rev 10505)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/StatisticsBrowserTest.java 2006-09-21 06:50:54 UTC (rev 10506)
@@ -0,0 +1,54 @@
+package org.hibernate.tool.stat;
+
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.classic.Session;
+import org.hibernate.test.TestCase;
+
+public class StatisticsBrowserTest extends TestCase {
+
+ public StatisticsBrowserTest(String name) {
+ super( name );
+ }
+
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.USE_STRUCTURED_CACHE, "true" );
+ }
+
+ public void testBrowser() throws Exception {
+ getSessions().getStatistics().setStatisticsEnabled( true );
+ new StatisticsBrowser().showStatistics( getSessions().getStatistics(), false );
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+
+ for(int i=0; i<100; i++) {
+ Group group = new Group( "Hibernate" + i );
+ group.addUser(new User("gavin" + i, "figo123"));
+ group.addUser(new User("cbauer" + i, "figo123"));
+ group.addUser(new User("steve" + i, "figo123"));
+ group.addUser(new User("max" + i, "figo123"));
+ group.addUser(new User("anthony" + i, "figo123"));
+
+ s.saveOrUpdate( group );
+ if(i % 20==0) s.flush();
+ }
+ s.flush();
+ s.clear();
+ s.createQuery( "from java.lang.Object" ).list();
+ tx.commit();
+ s.close();
+
+ Thread.sleep( 100000 );
+
+ }
+
+ protected String getBaseForMappings() {
+ return "org/hibernate/tool/stat/";
+ }
+ protected String[] getMappings() {
+ return new String[] { "UserGroup.hbm.xml"};
+ }
+
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/User.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/User.java 2006-09-21 06:48:20 UTC (rev 10505)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/User.java 2006-09-21 06:50:54 UTC (rev 10506)
@@ -0,0 +1,37 @@
+//$Id: User.java 5686 2005-02-12 07:27:32Z steveebersole $
+package org.hibernate.tool.stat;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+ private String name;
+ private String password;
+ private Set session = new HashSet();
+ User() {}
+ public User(String n, String pw) {
+ name=n;
+ password = pw;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public Set getSession() {
+ return session;
+ }
+ public void setSession(Set session) {
+ this.session = session;
+ }
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/UserGroup.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/UserGroup.hbm.xml 2006-09-21 06:48:20 UTC (rev 10505)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/stat/UserGroup.hbm.xml 2006-09-21 06:50:54 UTC (rev 10506)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+-->
+
+<hibernate-mapping package="org.hibernate.tool.stat">
+
+ <class name="Group" table="groups">
+ <cache usage="read-write"/>
+ <id name="name"/>
+ <set name="users" cascade="save-update">
+ <cache usage="read-write"/>
+ <key column="groupName"/>
+ <one-to-many class="User"/>
+ </set>
+ </class>
+
+ <class name="User" table="users">
+ <cache usage="read-write"/>
+ <id name="name"/>
+ <property name="password"/>
+ <set name="session" cascade="persist,save-update,delete,delete-orphan">
+ <key column="userName" not-null="true"/>
+ <one-to-many class="SessionAttribute"/>
+ </set>
+ </class>
+
+ <class name="SessionAttribute" table="session_attributes">
+ <id name="id" access="field">
+ <generator class="native"/>
+ </id>
+ <property name="name" not-null="true" update="false"/>
+ <property name="stringData"/>
+ </class>
+
+
+
+</hibernate-mapping>
18 years, 2 months
Hibernate SVN: r10505 - in trunk/HibernateExt/tools/src: java/org/hibernate/tool/hbm2x java/org/hibernate/tool/hbm2x/doc test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:48:20 -0400 (Thu, 21 Sep 2006)
New Revision: 10505
Added:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/StringUtils.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
Log:
HBX-723 hbm2doc shows abstract classes as tables
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-09-21 06:48:20 UTC (rev 10505)
@@ -263,14 +263,15 @@
Table table = (Table) tables.next();
DocFile docFile = docFileManager.getTableDocFile(table);
+ if(docFile!=null) {
+ File file = docFile.getFile();
- File file = docFile.getFile();
+ Map parameters = new HashMap();
+ parameters.put("docFile", docFile);
+ parameters.put("table", table);
- Map parameters = new HashMap();
- parameters.put("docFile", docFile);
- parameters.put("table", table);
-
- processTemplate(parameters, VM_TABLES_TABLE, file);
+ processTemplate(parameters, VM_TABLES_TABLE, file);
+ }
}
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/StringUtils.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/StringUtils.java 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/StringUtils.java 2006-09-21 06:48:20 UTC (rev 10505)
@@ -1557,4 +1557,24 @@
return true;
}
+
+ /**
+ * Strip any of the supplied string from the start of a string but
+ * do not strip more than maxStrip characters.
+ * <p>
+ * If maxStrip value is zero then no restriction is imposed.
+ * <p>
+ * @param str the string to remove characters from
+ * @param strip the string to remove
+ * @param max characters to strip
+ * @return the stripped string
+ */
+ public static String stripStart(String str, String strip, int maxStrip) {
+ if (str == null) return null;
+
+ if (maxStrip > 0 && str.length() > maxStrip)
+ return stripStart(str.substring(0,maxStrip), strip) + str.substring(maxStrip);
+ else
+ return stripStart(str, strip);
+ }
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocFileManager.java 2006-09-21 06:48:20 UTC (rev 10505)
@@ -227,12 +227,13 @@
while (tables.hasNext() ) {
Table table = (Table) tables.next();
+ if(table.isPhysicalTable()) {
+ String tableFileName = table.getName() + ".html";
- String tableFileName = table.getName() + ".html";
+ DocFile tableDocFile = new DocFile(tableFileName, schemaFolder);
- DocFile tableDocFile = new DocFile(tableFileName, schemaFolder);
-
- tableDocFiles.put(table, tableDocFile);
+ tableDocFiles.put(table, tableDocFile);
+ }
}
}
}
@@ -373,7 +374,8 @@
* @return the DocFile.
*/
public DocFile getTableDocFile(Table table) {
- return (DocFile) tableDocFiles.get(table);
+ DocFile docFile = (DocFile) tableDocFiles.get(table);
+ return docFile;
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-09-21 06:48:20 UTC (rev 10505)
@@ -3,9 +3,11 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
@@ -130,7 +132,11 @@
Iterator tablesIter = cfg.getTableMappings();
while (tablesIter.hasNext() ) {
- Table table = (Table) tablesIter.next();
+ Table table = (Table) tablesIter.next();
+
+ if(!table.isPhysicalTable()) {
+ continue;
+ }
tables.add(table);
StringBuffer sb = new StringBuffer();
@@ -294,7 +300,8 @@
*/
public List getTables(String schema) {
- return (List) tablesBySchema.get(schema);
+ List list = (List) tablesBySchema.get(schema);
+ return list;
}
/**
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-09-21 06:48:20 UTC (rev 10505)
@@ -17,7 +17,8 @@
"Order.hbm.xml",
"LineItem.hbm.xml",
"Product.hbm.xml",
- "HelloWorld.hbm.xml"
+ "HelloWorld.hbm.xml",
+ "UnionSubclass.hbm.xml"
};
}
@@ -40,8 +41,13 @@
assertFileAndExists(new File(getOutputDir(), "tables/PUBLIC/summary.html") );
assertFileAndExists(new File(getOutputDir(), "tables/PUBLIC/Customer.html") );
+ assertFalse(new File(getOutputDir(), "tables/PUBLIC/UPerson.html").exists() );
+ assertFileAndExists(new File(getOutputDir(), "tables/PUBLIC/CROWN_USERS.html") );
assertFileAndExists(new File(getOutputDir(), "entities/org/hibernate/tool/hbm2x/Customer.html") );
+ assertTrue(new File(getOutputDir(), "entities/org/hibernate/tool/hbm2x/UPerson.html").exists() );
+ assertFileAndExists(new File(getOutputDir(), "entities/org/hibernate/tool/hbm2x/UUser.html") );
+
}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml 2006-09-21 06:30:46 UTC (rev 10504)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml 2006-09-21 06:48:20 UTC (rev 10505)
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping is a test mapping for hbm2java
+
+-->
+
+<hibernate-mapping package="org.hibernate.tool.hbm2x">
+ <class name="UPerson" abstract="true">
+ <cache usage="read-write" />
+ <id name="id" type="long">
+ <column name="PERSON_ID">
+ <comment>the primary key for hibernate</comment>
+ </column>
+ <generator class="sequence">
+ <param name="sequence">PERSON_SEQ</param>
+ </generator>
+ </id>
+
+ <property name="firstName" type="string">
+ <column name="FIRST_NAME" length="50" not-null="true">
+ <comment>the first name</comment>
+ </column>
+ </property>
+
+ <union-subclass name="UUser" table="CROWN_USERS" lazy="false">
+ <comment>Table of crown users</comment>
+ <property name="userName" type="string">
+ <column name="USER_NAME" length="15" not-null="true" unique="true">
+ <comment>the unique user id</comment>
+ </column>
+ </property>
+ </union-subclass>
+ </class>
+</hibernate-mapping>
+
18 years, 2 months
Hibernate SVN: r10504 - trunk/HibernateExt/tools/src/templates/doc/tables
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:30:46 -0400 (Thu, 21 Sep 2006)
New Revision: 10504
Modified:
trunk/HibernateExt/tools/src/templates/doc/tables/summary.ftl
Log:
use helper method when it exists
Modified: trunk/HibernateExt/tools/src/templates/doc/tables/summary.ftl
===================================================================
--- trunk/HibernateExt/tools/src/templates/doc/tables/summary.ftl 2006-09-21 06:29:58 UTC (rev 10503)
+++ trunk/HibernateExt/tools/src/templates/doc/tables/summary.ftl 2006-09-21 06:30:46 UTC (rev 10504)
@@ -26,7 +26,7 @@
</TR>
</THEAD>
<TBODY>
-<#foreach table in dochelper.tablesBySchema.get(schema)>
+<#foreach table in dochelper.getTables(schema)>
<TR>
<TD>
<A HREF='${docFileManager.getRef(docFile, docFileManager.getTableDocFile(table))}' TARGET="generalFrame">
18 years, 2 months
Hibernate SVN: r10503 - trunk/HibernateExt/tools/src/java/org/hibernate/cfg
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:29:58 -0400 (Thu, 21 Sep 2006)
New Revision: 10503
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
Log:
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2006-09-21 06:29:38 UTC (rev 10502)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2006-09-21 06:29:58 UTC (rev 10503)
@@ -4,7 +4,7 @@
*/
package org.hibernate.cfg;
-import java.beans.Introspector;
+
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
@@ -520,7 +520,7 @@
processedColumns,
mapping
);
-
+
rc.addProperty(property);
}
}
18 years, 2 months
Hibernate SVN: r10502 - trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:29:38 -0400 (Thu, 21 Sep 2006)
New Revision: 10502
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCReader.java
Log:
don't swallow too generic exception
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCReader.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCReader.java 2006-09-21 06:28:59 UTC (rev 10501)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCReader.java 2006-09-21 06:29:38 UTC (rev 10502)
@@ -712,10 +712,10 @@
}
}
}
- catch (Throwable t) {
+ catch (JDBCException t) {
log.warn("Exception while trying to get indexinfo on " + Table.qualify(table.getCatalog(), table.getSchema(), table.getName() ) + "=" + t.getMessage() );
// Bug #604761 Oracle getIndexInfo() needs major grants And other dbs sucks too ;)
- // http://sourceforge.net/tracker/index.php?func=detail&aid=604761&group_id=...
+ // http://sourceforge.net/tracker/index.php?func=detail&aid=604761&group_id=...
}
finally {
if (indexIterator != null) {
18 years, 2 months
Hibernate SVN: r10501 - trunk/HibernateExt/tools/doc/reference/en/modules
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-21 02:28:59 -0400 (Thu, 21 Sep 2006)
New Revision: 10501
Modified:
trunk/HibernateExt/tools/doc/reference/en/modules/codegenarchitecture.xml
trunk/HibernateExt/tools/doc/reference/en/modules/plugins.xml
Log:
validaiton errors
Modified: trunk/HibernateExt/tools/doc/reference/en/modules/codegenarchitecture.xml
===================================================================
--- trunk/HibernateExt/tools/doc/reference/en/modules/codegenarchitecture.xml 2006-09-20 21:18:03 UTC (rev 10500)
+++ trunk/HibernateExt/tools/doc/reference/en/modules/codegenarchitecture.xml 2006-09-21 06:28:59 UTC (rev 10501)
@@ -25,12 +25,12 @@
<para><mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/architecture.png" format="png" />
+ <imagedata fileref="images/architecture.png" format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
- fileref="../shared/images/architecture.png" format="png" />
+ fileref="../shared/images/architecture.png" format="PNG" />
</imageobject>
</mediaobject></para>
@@ -54,7 +54,7 @@
<para>Users can provide their own customer Exporter's, either by custom
classes implementing the Exporter interface or simply be providing custom
- templates. This is documented at <xref linkend="hbmtemplate" /></para>
+ templates. This is documented at <xref linkend="hbmtemplate"/></para>
<para>NOTICE: This release uses Velocity for the templates. The next
release might move to an alternative template engine.</para>
Modified: trunk/HibernateExt/tools/doc/reference/en/modules/plugins.xml
===================================================================
--- trunk/HibernateExt/tools/doc/reference/en/modules/plugins.xml 2006-09-20 21:18:03 UTC (rev 10500)
+++ trunk/HibernateExt/tools/doc/reference/en/modules/plugins.xml 2006-09-21 06:28:59 UTC (rev 10501)
@@ -52,13 +52,13 @@
<mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/hibernatecfgwizard.gif" format="gif" contentwidth="5cm" />
+ <imagedata fileref="images/hibernatecfgwizard.gif" format="GIF" contentwidth="5cm" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/hibernatecfgwizard.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -79,11 +79,9 @@
</section>
<section>
-
-
<title>Creating a Hibernate Console configuration</title>
- A Console Configuration describes to the Hibernate plugin which configuration files should be used to configure hibernate, including which classpath is needed to load the POJO's, JDBC drivers etc. It is required to make usage of query prototyping, reverse engineering and code generation. You can have multiple named console configurations. Normally you would just need one per project, but more (or less) is definitly possible.
+ <para>A Console Configuration describes to the Hibernate plugin which configuration files should be used to configure hibernate, including which classpath is needed to load the POJO's, JDBC drivers etc. It is required to make usage of query prototyping, reverse engineering and code generation. You can have multiple named console configurations. Normally you would just need one per project, but more (or less) is definitly possible. </para>
<para>You create a console configuration by running the Console
Configuration wizard, shown in the following screenshot. The same wizard
@@ -102,7 +100,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/consolecfgwizard.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -278,7 +276,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/consoleoutline-before-reveng.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -315,7 +313,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/codegendropdown.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -332,7 +330,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/codegenmaintab.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -472,7 +470,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/codegenexporters.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -582,7 +580,7 @@
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/hbmxmlcompletion.gif"
- format="gif" />
+ format="GIF" />
</imageobject>
</mediaobject>
@@ -669,13 +667,13 @@
<para><mediaobject>
<imageobject role="fo">
<imagedata fileref="images/cfgxml-propertycomplete.png"
- format="png" />
+ format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/cfgxml-propertycomplete.png"
- format="png" />
+ format="PNG" />
</imageobject>
</mediaobject></para>
</section>
@@ -709,13 +707,13 @@
<para><mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/revengxml_overview.png" format="png" />
+ <imagedata fileref="images/revengxml_overview.png" format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/revengxml_overview.png"
- format="png" />
+ format="PNG" />
</imageobject>
</mediaobject></para>
@@ -725,13 +723,13 @@
<para><mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/revengxml_tablefilters.png" format="png" />
+ <imagedata fileref="images/revengxml_tablefilters.png" format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/revengxml_tablefilters.png"
- format="png" />
+ format="PNG" />
</imageobject>
</mediaobject></para>
@@ -741,13 +739,13 @@
<para><mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/revengxml_typemappings.png" format="png" />
+ <imagedata fileref="images/revengxml_typemappings.png" format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/revengxml_typemappings.png"
- format="png" />
+ format="PNG" />
</imageobject>
</mediaobject></para>
@@ -757,13 +755,13 @@
<para><mediaobject>
<imageobject role="fo">
- <imagedata fileref="images/revengxml_tablescolumn.png" format="png" />
+ <imagedata fileref="images/revengxml_tablescolumn.png" format="PNG" />
</imageobject>
<imageobject role="html">
<imagedata align="center"
fileref="../shared/images/revengxml_tablescolumn.png"
- format="png" />
+ format="PNG" />
</imageobject>
</mediaobject></para>
</section>
@@ -781,8 +779,6 @@
<title>Viewing the entity structure</title>
-
-
<para>To view your new configuration and entity/class structure, expand
the Hibernate Console configuration by clicking on the + icon.</para>
@@ -792,7 +788,7 @@
browse the class/entity structure and see the relationships.</para>
-
+<para>
<mediaobject>
<imageobject role="fo">
<imagedata fileref="images/queryconsole.png" />
@@ -805,7 +801,7 @@
</mediaobject>
Hibernate Console perspective showing entity structure, query editor and result
-
+</para>
<section>
<title>Class Diagram</title>
@@ -900,7 +896,7 @@
<imageobject role="html">
<imagedata align="center"
- fileref="../shared/images/properties.png" format="png" />
+ fileref="../shared/images/properties.png" format="PNG" />
</imageobject>
</mediaobject></para>
</section>
18 years, 2 months
Hibernate SVN: r10500 - trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-20 17:18:03 -0400 (Wed, 20 Sep 2006)
New Revision: 10500
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
Log:
HBX-759
include Second level cache statistics (no entry browsing yet)
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java 2006-09-20 17:11:37 UTC (rev 10499)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java 2006-09-20 21:18:03 UTC (rev 10500)
@@ -15,6 +15,7 @@
import javax.swing.ToolTipManager;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
+import javax.swing.table.TableCellRenderer;
import org.hibernate.stat.Statistics;
@@ -47,7 +48,17 @@
JScrollPane treePane = new JScrollPane(tree);
- final JTable table = new JTable();
+ final JTable table = new JTable() {
+ public TableCellRenderer getDefaultRenderer(Class columnClass) {
+ TableCellRenderer defaultRenderer = super.getDefaultRenderer( columnClass );
+
+ if(defaultRenderer==null) {
+ return super.getDefaultRenderer( Object.class );
+ } else {
+ return defaultRenderer;
+ }
+ }
+ };
JScrollPane tablePane = new JScrollPane(table);
tablePane.getViewport().setBackground( table.getBackground() );
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java 2006-09-20 17:11:37 UTC (rev 10499)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java 2006-09-20 21:18:03 UTC (rev 10500)
@@ -1,6 +1,11 @@
package org.hibernate.tool.stat;
+import java.util.Collections;
+import java.util.Map;
+
+import org.hibernate.stat.SecondLevelCacheStatistics;
import org.hibernate.stat.Statistics;
+import org.hibernate.util.IdentityMap;
public class StatisticsTreeModel extends AbstractTreeModel {
@@ -9,9 +14,10 @@
String queries = "Queries";
String entities = "Entities";
String collections = "Collections";
+ String secondlevelcache = "Cache";
+ Map im = IdentityMap.instantiate( 10 );
-
public StatisticsTreeModel(Statistics stats) {
this.stats = stats;
}
@@ -21,7 +27,8 @@
switch(index) {
case 0: return entities;
case 1: return collections;
- case 2: return queries;
+ case 2: return queries;
+ case 3: return secondlevelcache;
}
} else if(parent==entities) {
return stats.getEntityStatistics(stats.getEntityNames()[index]);
@@ -29,19 +36,29 @@
return stats.getCollectionStatistics(stats.getCollectionRoleNames()[index]);
} else if(parent==queries) {
return stats.getQueryStatistics(stats.getQueries()[index]);
+ } else if(parent==secondlevelcache) {
+ return stats.getSecondLevelCacheStatistics( stats.getSecondLevelCacheRegionNames()[index]);
+ } else if(parent instanceof SecondLevelCacheStatistics) {
+ SecondLevelCacheStatistics stats = (SecondLevelCacheStatistics) parent;
+ return stats.getEntries();
}
return null;
}
public int getChildCount(Object parent) {
if(parent==stats) {
- return 3;
+ return 4;
} else if(parent==entities) {
return stats.getEntityNames().length;
} else if(parent==collections) {
return stats.getCollectionRoleNames().length;
} else if(parent==queries) {
return stats.getQueries().length;
+ } else if(parent==secondlevelcache) {
+ return stats.getSecondLevelCacheRegionNames().length;
+ } else if(parent instanceof SecondLevelCacheStatistics) {
+ /*SecondLevelCacheStatistics stats = (SecondLevelCacheStatistics) parent;
+ return stats.getEntries().size();*/
}
return 0;
}
@@ -71,8 +88,12 @@
return o==entities; // hack
}
+ public boolean isCache(Object o) {
+ return o==secondlevelcache;
+ }
+
public boolean isContainer(Object o) {
- return isEntities( o ) || isQueries( o ) || isCollections( o );
+ return isEntities( o ) || isQueries( o ) || isCollections( o ) || isCache( o );
}
}
\ No newline at end of file
18 years, 2 months
Hibernate SVN: r10499 - trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-09-20 13:11:37 -0400 (Wed, 20 Sep 2006)
New Revision: 10499
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
Log:
HBX-759
fixed imports
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java 2006-09-20 16:25:44 UTC (rev 10498)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsBrowser.java 2006-09-20 17:11:37 UTC (rev 10499)
@@ -17,9 +17,6 @@
import javax.swing.event.TreeSelectionListener;
import org.hibernate.stat.Statistics;
-import org.hibernate.stat.ui.BeanTableModel;
-import org.hibernate.stat.ui.StatisticsCellRenderer;
-import org.hibernate.stat.ui.StatisticsTreeModel;
/**
* Very rudimentary statistics browser.
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java 2006-09-20 16:25:44 UTC (rev 10498)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/stat/StatisticsTreeModel.java 2006-09-20 17:11:37 UTC (rev 10499)
@@ -1,7 +1,6 @@
package org.hibernate.tool.stat;
import org.hibernate.stat.Statistics;
-import org.hibernate.stat.ui.AbstractTreeModel;
public class StatisticsTreeModel extends AbstractTreeModel {
18 years, 2 months