-->
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: generating @hibernate.map from XDoclet
PostPosted: Mon Sep 05, 2005 9:45 am 
Beginner
Beginner

Joined: Tue Nov 18, 2003 10:16 am
Posts: 33
Location: Cluj-Napoca, Romania
Hello!

I need to generate an One-to-many relationship using the <map> tag

Here is the example hbm file which is working properly.

[code]<map name="itemResponses" lazy="true" table="response_items">
<key column="response_id"/>
<map-key column="map_key" type="string"/>
<element type="string" column="map_value" not-null="true"/>
</map>
[/code]

But it seems that i cannot find Xdoclet tags for doing this html from java code.

Am i missing something here? Or Xdoclet is incomplete?

Many thanks,

Florin Marcus


Top
 Profile  
 
 Post subject: combination
PostPosted: Mon Sep 05, 2005 5:48 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I guess you need combination of several XDoclet tags: map, collection-index, and collection-element
http://xdoclet.sourceforge.net/xdoclet/ ... map__0__1_
http://xdoclet.sourceforge.net/xdoclet/ ... dex__0__1_
http://xdoclet.sourceforge.net/xdoclet/ ... ent__0__1_

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 8:56 am 
Beginner
Beginner

Joined: Mon Sep 22, 2003 5:18 am
Posts: 28
Did you solve the problem with map mapping using xDoclet ?
I use xDoclet 2 to generate <map> properties in hbm.xml. Here is the xdoclet tags usage:

* @hibernate.map
* cascade = "all"
*
* @hibernate.key
* column = "someParentIdInValueObject"
*
* @hibernate.map-key
* column = "someIdOfKeyObject"
* type = "com.my.KeyObjectClass"
*
* @hibernate.one-to-many
* class = "com.my.ValueObjectClass"

Here we have 'key' and 'value' objects in Map mapped to KeyObjectClass and ValueObjectClass repsectivly
The usage of Map is similar to other 'one-to-many' collections mapping, like set, list, etc.

I was able to generate correct mapping file, however had some problems with persisting newly created and pre-populated object with non-empty map property.

Hope this help


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.