-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate -> XML throws exception
PostPosted: Mon Oct 10, 2005 10:54 am 
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5 (25.5.2005)

Mapping documents:
Code:
   <class name="ObjectDescription" entity-name="ObjectDescription" node="object">

      <id name="m_idx" column="objectdescidx" node="@idx">
         <generator class="uuid" />
      </id>

      <property name="m_name" unique="true" node="@name" column="name"/>

      <set name="m_attributes" inverse="true" lazy="false" cascade="all" embed-xml="true" node=".">
         <key column="objectdescidx"/>
         <one-to-many class="AttributeDescription" entity-name="AttributeDescription" node="attribute" embed-xml="true"/>
      </set>

   </class>

   <class name="AttributeDescription" entity-name="AttributeDescription" node="attribute">

      <id name="m_idx" column="attributedescidx" node="@idx">
         <generator class="uuid" />
      </id>

      <many-to-one name="m_owner" column="objectdescidx" entity-name="ObjectDescription" embed-xml="false" cascade="all"/>

      <property name="m_name" unique="false" column="name" node="@name"/>
      <property name="m_dataType" column="datatype" node="dataType"/>
      <property name="m_dataCategory" column="datacategory" node="dataCategory"/>
      <property name="m_length" column="length" node="length"/>
      <property name="m_accuracy" column="accuracy" node="accuracy"/>
      <property name="m_visibleName" column="visiblename" node="visibleName"/>
      <property name="m_databaseUnit" column="dbunit" node="databaseUnit" />
      <property name="m_uiUnit" column="uiunit" node="uiUnit"/>
      <property name="m_description" column="description" node="description"/>
      <property name="m_minValue" column="minvalue" node="minValue"/>
      <property name="m_maxValue" column="maxvalue" node="maxValue"/>
      <property name="m_mandatory" column="mandatory" node="mandatory"/>
      <property name="m_validatorClass" column="validatorclass"/>
      <property name="m_lookupClass" column="lookupclass"/>
      <property name="m_editorClass" column="editorclass"/>

   </class>

Code between sessionFactory.openSession() and session.close():
NOTE: this.getSession() returns the session from the managed bean session factory in jboss

Code:
      Session session = getSession().getSession(EntityMode.DOM4J);
      Document out = DocumentHelper.createDocument();
      List results = session.createCriteria("ObjectDescription").setFetchMode("m_attributes",
         FetchMode.JOIN).add(Restrictions.idEq(objectdescription.getIdx())).list();
      for (int i = 0; i < results.size(); i++)
      {
         // add the customer data to the XML document
         Element customer = (Element) results.get(i);
         out.add(customer);
      }

      System.out.println(out.asXML());


Full stack trace of any exception that occurs:
Code:
16:36:47,312 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract void de.xxxx.YYYY.exportSchema(java.lang.String) throws java.rmi.RemoteException,java.lang.Exception, causedBy:
org.hibernate.HibernateException: Class not found: double
        at org.hibernate.type.ClassType.get(ClassType.java:28)
        at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
        at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
        at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
        at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEnti
tyPersister.java:1680)
        at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:958)
        at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:909)
        at org.hibernate.loader.Loader.getRow(Loader.java:822)
        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:297)
        at org.hibernate.loader.Loader.doQuery(Loader.java:395)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:210)
        at org.hibernate.loader.Loader.doList(Loader.java:1561)
        at org.hibernate.loader.Loader.list(Loader.java:1544)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java
:111)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1306)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
        at de.xxxx.YYYY.exportSchema(...)
        at sun.reflect.GeneratedMethodAccessor218.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:214)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:185)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:130)
        at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(Service
EndpointInterceptor.java:51)
        at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
Interceptor.java:48)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:105)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:335)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
66)
        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:139)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:122)
        at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:6
24)
        at org.jboss.ejb.Container.invoke(Container.java:873)
        at sun.reflect.GeneratedMethodAccessor211.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:249)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
        at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke
(JRMPInvoker.java:805)
        at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
406)
        at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
        at java.lang.Thread.run(Thread.java:595)

Name and version of the database you are using:
MySQL 4.1


With the normal session (not the dom4j session) it works, but with the dom4j session, the exception is thrown....


Well, even the example on HibernateDocumentation chapter 19 doesn't work. It does not return accounts!

Why?

r.


Top
  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 11:30 am 
Additionally, I think the inverse is not correctly filled, because:

when I run the following code piece...

Code:
      List results = getSession()
       .createQuery("from ObjectDescription od left join fetch od.m_attributes where od.m_name like :name")
       .setString("name", objectdescription.getName())
       .list();
      for (int i = 0; i < results.size(); i++)
      {
         ObjectDescription od = (ObjectDescription)results.get(i);
         for (AttributeDescription ad : od.getAttributes())
         {
            System.out.println("1:"+od.getName()+"."+ad.getName());
         }
         List atts = getSession()
          .createQuery("from AttributeDescription a where a.m_owner like :idx")
          .setString("idx", od.getIdx())
          .list();
         for (int j = 0; j < atts.size(); j++)
         {
            AttributeDescription ad = (AttributeDescription)atts.get(j);
            System.out.println("2:"+od.getName()+"."+ad.getName());
         }
      }


... it prints me out only lines starting with "2:" and so the direct call to getAttributes() returns an empty list instead the inverse list, filled by setting the owner to the desired objectdescription object.

I've also tried several lazy and fetching strategies, all with the same effect: the collection of the object is never updated/filled!

:confused:
r.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.