-->
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.  [ 1 post ] 
Author Message
 Post subject: XML input for updates
PostPosted: Tue May 09, 2006 11:47 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
Hibernate version:
3.1.2

I am writing a utility to export and import data between the database
and XML.

I have the output part going, for example:

<class name="com.myorg.export.Detail" node="Detail" table="WDetail" >
<id name="FID" type="int" unsaved-value="0">
<generator class="assigned"/>
</id>
<property name="TID" type="int"/>
<property name="displayName" type="string"/>
</class>

Note that I have a class mapping _and_ use the node attribute to
format the XML output. This appears to be in line with the
intended use of session.getSession(EntityMode.DOM4J).

The overall mapping of course is much more complex than this...

For input from XML, I create a dom4J session, and
call
session.update(el);
for the 'Detail' Element from my XML tree.

For that I get:
org.hibernate.MappingException: Unknown entity: Detail
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:513)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1321)

Q: shouldn't the SessionFactory be able to work out that 'Detail' is the node name used in conjunction with class "com.myorg.export.Detail"?

Is this a reasonable feature request?
How would I implement it?

I realize that the when I use
entity-name="Detail"
all is well, except that I just lost the ability to map my class "com.myorg.export.Detail", which I don't like.

Also interesting is the fact that if I change the node attribute to
node="Detail2"
then the session still insists on finding a 'Detail' Element,
which is, in my mind, semantically incorrect.

Has anybody experience with this type of usage of the XML feature in H3?

Should I just go an enhance my classes to be able to instantiate
from the XML to avoid the problems I'm hitting?


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

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.