jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: OCM: how to persist Maps?
Date Thu, 28 Aug 2008 19:18:26 GMT
Hi Alex,

Yes, the Map support was not very good and I worked on that this week.
With my latest commit, you can use a map like this :

@Node
public class MyClass
{

    @Collection Map<String,AnotherClass> map;

}

Of course, HashMap is also supported. AnotherClass has to be a persistent
class. Is it your case ?
The current limitation is to use a String as the map Key because the key is
used to create a subnode matching to the element stored into the map.  I'm
thinking about how to support other types for the map key.

See the unit test :
/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest
to get an example.




> May be we need @Map annotation?


Why not to use the Jpa annotation names ? OneToMany, ManyToOne, ...
That the same for @Node. We can rename it into @Entity

Let me know if you need more help or if you have some questions.


br,
Christophe

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message