-->
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.  [ 4 posts ] 
Author Message
 Post subject: mongodb @ElementCollection inside another @ElementCollection
PostPosted: Fri Apr 10, 2015 3:52 am 
Newbie

Joined: Wed Mar 18, 2015 11:38 am
Posts: 10
Hi everyone,

I am using mongodb as database and i am mapping all my collections and some of them have subcollections inside. Some of these have a subcollection inside too but i am getting an error saying to me that this can not be done..so...

is there a solution for this case of use?

Thanks and regards!


Top
 Profile  
 
 Post subject: Re: mongodb @ElementCollection inside another @ElementCollection
PostPosted: Fri Apr 10, 2015 5:11 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
that kind of mapping violates the JPA specification.

The following post should answer your querstion: https://forum.hibernate.org/viewtopic.php?f=31&t=1038740&start=0&hilit=%40ElementCollection

Cheers,
Davide


Top
 Profile  
 
 Post subject: Re: mongodb @ElementCollection inside another @ElementCollection
PostPosted: Sat Apr 11, 2015 1:21 am 
Newbie

Joined: Wed Mar 18, 2015 11:38 am
Posts: 10
ok, it is a violation of the JPA spec, but how do i do this case of use?

I have the user entity that has a column user_roles and each rol has some permissions...

I think this case of use or similars are usual in any logic of business so..how can i do this supposing i use mongodb and i want to use embbeded objects/collections?

thanks and regards!


Top
 Profile  
 
 Post subject: Re: mongodb @ElementCollection inside another @ElementCollection
PostPosted: Tue Apr 14, 2015 5:37 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
at the moment we don't support that particular mapping in MongoDB.

I think you can try following Emmanuel suggestion in the post I linked (https://forum.hibernate.org/viewtopic.php?f=31&t=1038740&start=0&hilit=%40ElementCollection):

you can simulate the @ElementCollection semantic mapping the user role as a plain entity and using @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true).


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