[Commits] (bcm) manually maintain model class hibernate mappings. this allows us to get rid of

commits at osafoundation.org commits at osafoundation.org
Tue Apr 12 16:27:32 PDT 2005


Commit by: bcm
Modified files:
server/build.xml 1.31 1.32
server/shared.properties 1.19 1.20
server/core/build.xml 1.16 1.17
server/core/etc/Role.hbm.xml None 1.1
server/core/etc/User.hbm.xml None 1.1
server/core/etc/hibernate.cfg.xml 1.1 1.2
server/core/src/org/osaf/cosmo/model/Role.java 1.2 1.3
server/core/src/org/osaf/cosmo/model/User.java 1.3 1.4
server/core/test/etc/hibernate.cfg.xml None 1.1

Log message:
manually maintain model class hibernate mappings. this allows us to get rid of
xdoclet altogether. makes the build much faster and will make mavenization
easier too. 


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/server/build.xml.diff?r1=text&tr1=1.31&r2=text&tr2=1.32
http://cvs.osafoundation.org/index.cgi/server/shared.properties.diff?r1=text&tr1=1.19&r2=text&tr2=1.20
http://cvs.osafoundation.org/index.cgi/server/core/build.xml.diff?r1=text&tr1=1.16&r2=text&tr2=1.17
http://cvs.osafoundation.org/index.cgi/server/core/etc/Role.hbm.xml?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/server/core/etc/User.hbm.xml?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/server/core/etc/hibernate.cfg.xml.diff?r1=text&tr1=1.1&r2=text&tr2=1.2
http://cvs.osafoundation.org/index.cgi/server/core/src/org/osaf/cosmo/model/Role.java.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/server/core/src/org/osaf/cosmo/model/User.java.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/server/core/test/etc/hibernate.cfg.xml?rev=1.1&content-type=text/vnd.viewcvs-markup

Index: server/core/src/org/osaf/cosmo/model/Role.java
diff -u server/core/src/org/osaf/cosmo/model/Role.java:1.2 server/core/src/org/osaf/cosmo/model/Role.java:1.3
--- server/core/src/org/osaf/cosmo/model/Role.java:1.2	Tue Apr 12 15:57:36 2005
+++ server/core/src/org/osaf/cosmo/model/Role.java	Tue Apr 12 16:27:30 2005
@@ -8,7 +8,6 @@
 import org.apache.commons.lang.builder.HashCodeBuilder;
 
 /**
- * @hibernate.class table="role"
  */
 public class Role extends BaseModelObject {
 
@@ -24,10 +23,6 @@
     }
 
     /**
-     * @hibernate.id column="name" unsaved-value="null"
-     *               generator-class="assigned"
-     * @hibernate.column name="name" sql-type="string" length="32"
-     *                   not-null="true"
      */
     public String getName() {
         return name;
@@ -40,7 +35,6 @@
     }
 
     /**
-     * @hibernate.property column="dateCreated" not=null="true"
      */
     public Date getDateCreated() {
         return dateCreated;
@@ -53,7 +47,6 @@
     }
 
     /**
-     * @hibernate.property column="dateModified" not=null="true"
      */
     public Date getDateModified() {
         return dateModified;
@@ -66,11 +59,6 @@
     }
 
     /**
-     * @hibernate.set name="users" table="userrole"
-     *                lazy="true" inverse="true"
-     * @hibernate.collection-key column="rolename"
-     * @hibernate.collection-many-to-many column="username"
-     *                class="org.osaf.cosmo.model.User"
      */
     public Set getUsers() {
         return users;

Index: server/shared.properties
diff -u server/shared.properties:1.19 server/shared.properties:1.20
--- server/shared.properties:1.19	Mon Apr 11 17:13:28 2005
+++ server/shared.properties	Tue Apr 12 16:27:28 2005
@@ -16,17 +16,9 @@
 compile.target=1.4
 
 #
-# hibernatedoclet options
-#
-
-hibernate.verbose=false
-
-#
 # filesystem locations
 #
 
-xdoclet.home=${env.XDOCLET_HOME}
-
 cosmo.ext=${cosmo.home}/ext
 cosmo.tmp=${java.io.tmpdir}
 cosmo.bin=${cosmo.home}/bin

Index: server/core/etc/hibernate.cfg.xml
diff -u server/core/etc/hibernate.cfg.xml:1.1 server/core/etc/hibernate.cfg.xml:1.2
--- server/core/etc/hibernate.cfg.xml:1.1	Tue Apr 12 15:57:36 2005
+++ server/core/etc/hibernate.cfg.xml	Tue Apr 12 16:27:29 2005
@@ -9,8 +9,8 @@
     <property name="dialect">@DIALECT@</property>
     <property name="show_sql">false</property>
     <property name="use_outer_join">false</property>
-    <mapping resource="org/osaf/cosmo/model/Role.hbm.xml"/>
-    <mapping resource="org/osaf/cosmo/model/User.hbm.xml"/>
+    <mapping resource="Role.hbm.xml"/>
+    <mapping resource="User.hbm.xml"/>
     <class-cache class="org.osaf.cosmo.model.Role"
                  usage="read-write"/>
     <collection-cache collection="org.osaf.cosmo.model.Role.users"

Index: server/build.xml
diff -u server/build.xml:1.31 server/build.xml:1.32
--- server/build.xml:1.31	Tue Apr 12 14:54:27 2005
+++ server/build.xml	Tue Apr 12 16:27:28 2005
@@ -1,12 +1,9 @@
 
 <project name="Cosmo" default="all" basedir=".">
-
   <property name="cosmo.home"           value="${basedir}"/>
-
   <property environment="env"/>
   <property file="build.properties"/>
   <property file="shared.properties"/>
-
   <property name="cosmo.dist"           value="${cosmo.home}/dist"/>
   <property name="cosmo.dist.version"
             value="${cosmo.dist}/cosmo-${cosmo.version}"/>
@@ -14,15 +11,6 @@
   <property name="cosmo.dist.webapps"   value="${cosmo.dist.tomcat}/webapps"/>
   <property name="cosmo.dist.web"       value="${cosmo.dist.webapps}/cosmo"/>
 
-  <taskdef name="hibernatedoclet"
-           classname="xdoclet.modules.hibernate.HibernateDocletTask">
-    <classpath>
-      <fileset dir="${xdoclet.home}">
-        <include name="*.jar"/>
-      </fileset>
-    </classpath>
-  </taskdef>
-
   <!-- BUILD TARGETS -->
 
   <target name="all"
@@ -63,19 +51,17 @@
   <!-- TEST TARGETS -->
 
   <target name="test-gen"
-          description="generate test Hibernate config file">
-    <hibernatedoclet destDir="${cosmo.test}"
-                     excludedtags="@version, at author, at todo"
-                     verbose="${hibernate.verbose}">
-      <fileset dir="${core.home}/src">
-        <include name="**/*.java"/>
-      </fileset>
-      <hibernatecfg dialect="${cosmo.test.userdb.dialect}"
-                    driver="${cosmo.test.userdb.driver}"
-                    jdbcUrl="${cosmo.test.userdb.url}"
-                    username="${cosmo.test.userdb.username}"
-                    password="${cosmo.test.userdb.password}"/>
-    </hibernatedoclet>
+          description="">
+    <copy todir="${cosmo.test}"
+          file="${core.test}/etc/hibernate.cfg.xml">
+      <filterset>
+        <filter token="DB_USERNAME" value="${cosmo.test.userdb.username}"/>
+        <filter token="DB_PASSWORD" value="${cosmo.test.userdb.password}"/>
+        <filter token="DB_DRIVER" value="${cosmo.test.userdb.driver}"/>
+        <filter token="DB_URL" value="${cosmo.test.userdb.url}"/>
+        <filter token="DIALECT" value="${cosmo.test.userdb.dialect}"/>
+      </filterset>
+    </copy>
   </target>
 
   <target name="test-dbsetup"

Index: server/core/build.xml
diff -u server/core/build.xml:1.16 server/core/build.xml:1.17
--- server/core/build.xml:1.16	Tue Apr 12 15:57:36 2005
+++ server/core/build.xml	Tue Apr 12 16:27:29 2005
@@ -1,21 +1,10 @@
 
 <project name="Cosmo Core" default="all" basedir=".">
-
   <property name="cosmo.home"           value="${basedir}/.."/>
-
   <property environment="env"/>
   <property file="${cosmo.home}/build.properties"/>
   <property file="${cosmo.home}/shared.properties"/>
 
-  <taskdef name="hibernatedoclet"
-           classname="xdoclet.modules.hibernate.HibernateDocletTask">
-    <classpath>
-      <fileset dir="${xdoclet.home}">
-        <include name="*.jar"/>
-      </fileset>
-    </classpath>
-  </taskdef>
-
   <!-- CLASSPATHS -->
 
   <path id="ext.classpath">
@@ -41,19 +30,7 @@
     <mkdir dir="${core.build}/classes"/>
   </target>
 
-  <target name="gen" depends="prepare"
-          description="generate Hibernate mapping files">
-    <hibernatedoclet destDir="${core.build}/classes"
-                     excludedtags="@version, at author, at todo"
-                     verbose="${hibernate.verbose}">
-      <fileset dir="${core.src}">
-        <include name="**/*.java"/>
-      </fileset>
-      <hibernate version="2.0"/>
-    </hibernatedoclet>
-  </target>
-
-  <target name="compile" depends="prepare,gen"
+  <target name="compile" depends="prepare"
           description="build the source">
     <javac srcdir="${core.src}"
            destdir="${core.build}/classes"

Index: server/core/src/org/osaf/cosmo/model/User.java
diff -u server/core/src/org/osaf/cosmo/model/User.java:1.3 server/core/src/org/osaf/cosmo/model/User.java:1.4
--- server/core/src/org/osaf/cosmo/model/User.java:1.3	Tue Apr 12 15:57:36 2005
+++ server/core/src/org/osaf/cosmo/model/User.java	Tue Apr 12 16:27:30 2005
@@ -8,7 +8,6 @@
 import org.apache.commons.lang.builder.HashCodeBuilder;
 
 /**
- * @hibernate.class table="user"
  */
 public class User extends BaseModelObject {
 
@@ -26,10 +25,6 @@
     }
 
     /**
-     * @hibernate.id column="username" unsaved-value="null"
-     *               generator-class="assigned"
-     * @hibernate.column name="username" sql-type="string" length="32"
-     *                   not-null="true"
      */
     public String getUsername() {
         return username;
@@ -42,8 +37,6 @@
     }
 
     /**
-     * @hibernate.property column="password" length="32"
-     *                     not=null="true"
      */
     public String getPassword() {
         return password;
@@ -56,8 +49,6 @@
     }
 
     /**
-     * @hibernate.property column="email" length="32"
-     *                     not=null="true"
      */
     public String getEmail() {
         return email;
@@ -70,7 +61,6 @@
     }
 
     /**
-     * @hibernate.property column="dateCreated" not=null="true"
      */
     public Date getDateCreated() {
         return dateCreated;
@@ -83,7 +73,6 @@
     }
 
     /**
-     * @hibernate.property column="dateModified" not=null="true"
      */
     public Date getDateModified() {
         return dateModified;
@@ -96,11 +85,6 @@
     }
 
     /**
-     * @hibernate.set name="roles" table="userrole"
-     *                lazy="true"
-     * @hibernate.collection-key column="username"
-     * @hibernate.collection-many-to-many column="rolename"
-     *                class="org.osaf.cosmo.model.Role"
      */
     public Set getRoles() {
         return roles;



More information about the Commits mailing list