-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping to dom4j in 3.x (Newbie)
PostPosted: Fri Feb 03, 2006 12:48 pm 
Newbie

Joined: Fri Feb 03, 2006 11:35 am
Posts: 3
Hi

When I export a given (persisted) object instance to XML via a Session with EntityMode.DOM4J, it is exported without any package qualifiers, e.g.

<Root>
<HelloWorld>
<hello>Hello</hello>
<world>World</world>
...

However when I attempt to import the documents back into the database the operation fails, unless I use fully qualified Element names e.g.

<Root>
<com.acme.HelloWorld>
<hello>Hello</hello>
<world>World</world>
...

Is there a way around this? Am I doing something wrong for Hibernate to generate hbm.xmls with package qualifiers?

A second question on the dom4j mapping ... does anyone know if it is possible to import/export directly from a POJO to a dom4j object (without persisting the object(s))?

Thanks in advance

Barney


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 11:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Probably you are not properly using entity-name and node attributes. Hard to tell without seeing the mappings.

As for your last question, not yet. It is planned to 3.2 to have a transform() method that can take an entity in one representation and trasform it to another representation, all in memory.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 8:36 am 
Newbie

Joined: Fri Feb 03, 2006 11:35 am
Posts: 3
Thanks for the response.

I think my problem may be with XDoclet, which I used to generate the hbm.xmls - the generated mapping contains the package name in the class element, e.g.

Code:
<hibernate-mapping>
  <class polymorphism="implicit" name="hibernatebeans.HelloWorld">
    ....


The corresponding is as follows. It doesn't seem to make any difference whether or not I include the package name in the fileset "dir" attribute.

Code:
   <target name="xdoclet2">
        <mkdir dir="C:\XDoclet2\Make" />
        <taskdef name="xdoclet2" classname="org.xdoclet.ant.XDocletTask" classpathref="xdoclet.path" />
    </target>
    <target name="remove" depends="xdoclet2">
        <delete>
            <fileset dir="C:\XDoclet2\HibernateMappings">
                <include name="**/*.hbm.xml" />
            </fileset>
        </delete>
    </target>
    <target name="hibernate" depends="remove">
        <xdoclet2>
            <!-- defines the file handled by xdoclet2 -->
            <fileset dir="hibsrc/hibernatebeans">
                <include name="**/*.java" />
            </fileset>
            <!-- defines the processing of a plugin -->
            <component classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin" destdir="C:\XDoclet2\HibernateMappings" version="3.0" />
        </xdoclet2>
    </target>


Thanks for any insights.


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