-->
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.  [ 1 post ] 
Author Message
 Post subject: Readonly and Lazy Mapping
PostPosted: Mon Nov 11, 2013 9:01 am 
Newbie

Joined: Tue Sep 09, 2008 11:35 am
Posts: 10
I got an entity that has two mappings to the same table.

1. The first Mapping uses an Entity that maps all columns of the table. This entity is lazy loaded.
2. The second Mapping just maps a few columns of the table. This entity is eagerly and with read-only mode loaded.

When I am persisting the main entity the second Mapping is sometimes set to null, although there are values on the table.
What can I do, so that the second Mapping is filled correctly ?

Code:
@Entity
@Table(name = "Table1")
public class DocumentImpl extends AbstractTable {

  @Exclude(Skip.EVERYTHING)
  @JoinColumn(name = "DATA_ID", nullable = false)
  @OneToOne(targetEntity = DataFull.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
  private Data data= new DataFull();

  @JoinColumn(name = "DATA_ID", nullable = true, insertable = false, updatable = false)
  @OneToOne(targetEntity = DataMin.class, fetch = FetchType.EAGER)
  private Data dataMin;

....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.