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.  [ 2 posts ] 
Author Message
 Post subject: @Version Unchanged attributes version is increased
PostPosted: Wed May 04, 2011 7:39 am 
Newbie

Joined: Tue Feb 01, 2011 11:06 am
Posts: 3
Hi,

i've go a little problem with the @Versions annotation of hibernate(3.5.6 Final and jpa 2.0).
In my program there is a customer with version, who has got an address with a version.
If some value of the customer changes e.g. name the version of the customer is increased - good, but the version of the unchanged address is changed too - bad cause the attribute did not change.
How can this happen? Is it possible to fix this behaviour?

Thanks for any reply.

Code:

@Entity
@Table(name = CUSTOMER")
@Inheritance(strategy = InheritanceType.JOINED)
public class Customer
{

   @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
   @JoinColumn(name = "CUST_BILLING_ADDRESS_ID")
   @ForeignKey(name = "FK_CUSTOMER_BILLING_ADDRESS")
   @Valid
   private Address billingAddress;

   @Version
   @Column(name = "CUST_VERSION", nullable = true)
   private long version = 0;
...
}
@Entity
@Table(name = "ADDRESS")
public class Address
{

   @Version
   @Column(name = "ADDRESS_VERSION", nullable = true)
   private long version = 0;
...
}


Top
 Profile  
 
 Post subject: Re: @Version Unchanged attributes version is increased
PostPosted: Thu May 05, 2011 5:15 am 
Newbie

Joined: Tue Feb 01, 2011 11:06 am
Posts: 3
Not an error, only the symptom of the error.

closed


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