-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: xdoclet2 for Hibernate3 - please help
PostPosted: Tue Dec 26, 2006 10:52 pm 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
Hi,

I've read the article "xdoclet2 for Hibernate3" on your sites.
You propose there that one should use
ant-contrib-1.0b1.jar
commons-beanutils-1.7.0.jar
commons-collections-3.1.jar
commons-jelly-20050813.225330.jar
commons-jelly-tags-define-1.0.jar
commons-jelly-tags-jsl-1.0.jar
commons-jelly-tags-xml-20050823.222913.jar
commons-jexl-1.0.jar
commons-logging-1.0.4.jar
dom4j-1.6.jar
generama-1.2.1-SNAPSHOT.jar
jaxen-1.1-beta-4.jar
nanocontainer-1.0-beta-3.jar
nanocontainer-ant-1.0-beta-3.jar
picocontainer-1.0.jar
qdox-1.6-SNAPSHOT.jar
saxpath-1.0-FCS.jar
velocity-1.4.jar
xdoclet-2.0.3.jar
xdoclet-plugin-hibernate-1.0.2.jar


And I use it, even more - xdoclet-2.0.4.jar and
xdoclet-plugin-hibernate-1.0.3.jar

Everything seems to work almost properly, I get hbms but I can't have any use of them, for example for every propoerty form each class I get in my hbm:
<property name="customerId" not-null="true" access="method"/>

access="method" - THE PROBLEM is that hibernate 3 doesn't use that property, am I right? When I delete it from my hbms, the junit works.
So please, help me becouse I've tried doing it with mave, maven2, I failed, I use ant, because there are at least some examples, but it also doesn't work... Please tell me clearly what to do...
Do I have to use xdoclet1? - but does it generate hbms compatible with Hibernate 3 or the story will be the same? If I have to use it, can u update my build.xml - Im trying to make it work from 3 days and I really feel I need some help.


I also provide some additional information: The build.xml


Code:

<project name="Hibernate9" default="generate">

   <property file="build.properties" />


    <target name="init">

       <echo message="Clening..."/>
       <delete dir="target" failonerror="false"/>

       <echo message="Creating folders..."/>
        <mkdir dir="target"/>
        <mkdir dir="target/classes"/>
        <mkdir dir="target/jar"/>

       <echo message="Defining xdoclet2 ant task..."/>
        <path id="xdoclet2.task.classpath">
            <fileset dir="lib/xdoclet">
                <include name="*.jar"/>
            </fileset>
        </path>

        <path id="project.classpath">
            <fileset dir="lib">
                <include name="*.jar"/>
            </fileset>
        </path>

        <taskdef
            name="xdoclet2"
            classname="org.xdoclet.ant.XDocletTask"
            classpathref="xdoclet2.task.classpath"
            />
    </target>



   <target name="generate" depends="init" description="Cleans and builds everything.">
       <echo message="Generating hbms..."/>
        <xdoclet2>
            <fileset dir="source/src">
                <include name="**/*Model.java"/>
            </fileset>

            <component
                classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
                destdir="target/hbm"
                version="3.0"
                />
        </xdoclet2>

       <echo message="Compiling..."/>
      <javac classpathref="project.classpath" destdir="target/classes"
         srcdir="source/src">
      </javac>

       <echo message="Creating jar..."/>
      <jar destfile="target/jar/demo.jar">
         <fileset dir="target/classes"/>
         <fileset dir="resources"/>
         <fileset dir="target/hbm"/>
      </jar>

        <path id="hibernate.task.classpath">
            <fileset dir="lib">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="target/jar">
                <include name="*.jar"/>
            </fileset>
        </path>

       <echo message="Creating database schema..."/>
       <taskdef name="schemaexport"
            classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
            classpathref="hibernate.task.classpath"/>

      
          <schemaexport
              properties="resources/hibernate.properties"
              quiet="no"
              text="no"
              drop="no"
              delimiter=";"
              output="target/schema-export.sql">
              <fileset dir="target/hbm">
                  <include name="**/*.hbm.xml"/>
              </fileset>
          </schemaexport>

   </target>

</project>

   





when I run junit with some configuration i.e :
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource"><ref bean="dataSource"/></property>
     <property name="hibernateProperties">
         <util:properties location="hibernate.properties" />
      </property>
      <property name="mappingLocations">
         <list>
            <value>classpath:gma/demo/model/CustomerModel.hbm.xml</value>
         </list>
      </property>
  </bean>

I get stack

Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService' defined in class path resource [core-components.xml]: Cannot resolve reference to bean 'customerDao' while setting bean property 'customerDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDao' defined in class path resource [core-components.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [core-components.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not find PropertyAccessor class: method
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDao' defined in class path resource [core-components.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [core-components.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not find PropertyAccessor class: method
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [core-components.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: could not find PropertyAccessor class: method
Caused by: org.hibernate.MappingException: could not find PropertyAccessor class: method
   at org.hibernate.property.PropertyAccessorFactory.resolveCustomAccessor(PropertyAccessorFactory.java:107)
   at org.hibernate.property.PropertyAccessorFactory.getPojoPropertyAccessor(PropertyAccessorFactory.java:86)
   at org.hibernate.property.PropertyAccessorFactory.getPropertyAccessor(PropertyAccessorFactory.java:53)
   at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:167)
   at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
   at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:118)
   at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
   at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
   at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:807)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:740)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:646)
   at gma.demo.service.ComponentsFactory.getCustomerService(ComponentsFactory.java:49)
   at gma.demo.service.CustomerServiceTest2.testCreate(CustomerServiceTest2.java:33)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: method
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.property.PropertyAccessorFactory.resolveCustomAccessor(PropertyAccessorFactory.java:104)
   ... 59 more



Last edited by herbatniczek on Tue Dec 26, 2006 11:23 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: ok
PostPosted: Tue Dec 26, 2006 11:15 pm 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
ok, it works :)
i've found this topic:

http://forum.hibernate.org/viewtopic.ph ... fcb07abb19

and downloaded
xdoclet-plugin-hibernate-1.0.4-SNAPSHOT.jar
xdoclet-2.0.6.jar

i thought that if i download the latest version from the producent page - http://xdoclet.codehaus.org/HibernateTags it would be ok, but it wasn't

They should update their websites and so as you :) I lost to much time on it.

I leave this topic , maybe some other people will find it useful.

I've finished the java->hbm->sql path using Ant. Tommorow i'll work on the backward process, that is sql->hbm->java.

I anybody would show me how to input my ant task into pom.xml of maven2, I would be very grateful - because i've never done that before. I only read that it is very simple, thats why i'm asking :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 29, 2006 5:55 am 
Newbie

Joined: Fri Dec 29, 2006 5:51 am
Posts: 3
Hi,
i'm introducing myself with hibernate, and i need a litle help. I'm interesting in creating DB from sss.hbm.xml, and if you can explain to me how to do that, or send some example, which can help me in my work. My english is not very good, but I hope, that you can understand me.

Thanks, Djordje

_________________
ne patim od ludila, uzivam u njemu...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 8:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See the hibernate tools documentation - as a start look for hbm2java


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.