Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @OneToMany relations with @NOSQL don't works (Using @OneToMany relation with a @nosql database leads to errors)
@OneToMany relations with @NOSQL don't works [message #1014992] Wed, 27 February 2013 02:37 Go to previous message
jm collin is currently offline jm collin
Messages: 5
Registered: February 2013
Junior Member
Hello,

I'm using EclipseLink 2.4.0 with MongoDB 2.2.
I've got a Entity which has a @OneToMany relation to itself :
@Entity
@NoSql(dataType="userGroup", dataFormat=DataFormatType.MAPPED)
public class Group extends JPAMongoBaseEntity {
	@Id
	@Field(name="_id")
	@GeneratedValue
	private String id;
	
	// Only the direct subGroup are set (not the subGroup of the subGroup)
	@OneToMany(targetEntity=Group.class, fetch=FetchType.LAZY, cascade=CascadeType.REMOVE)
	@Field(name="directSubGroups")
	private List<Group> directSubGroups = new ArrayList<>();
...

When I use this relation, items added to the relation - entity.getDirectSubGroups().add(...) are correctly send to database.
but when EclipseLink retrieve the entity from database, the relation is always empty.
So the next add will override the previous and only the last .add() will persist.

Any help will be greatly appreciated.


 
Read Message
Read Message
Read Message
Read Message
Previous Topic:Problem mongodb query/find by id
Next Topic:Convert .NET DateTimeOffset <--> Jodatime DateTime (utc)
Goto Forum:
  


Current Time: Sun May 19 15:05:56 EDT 2013

Powered by FUDForum. Page generated in 0.01726 seconds