-->
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: Keeping data in sync
PostPosted: Sat Nov 07, 2009 10:15 pm 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
I have two entities which some fields of one entity is a mirror of the same field in the other. Let say product and inventory:
Code:
class Product {
    private int productID;
    private String productCode;
    private double price;
    ...
}

class Inventory {
    private int productID;
    private String productCode;
    private double price;
    ...
    // own fields
}

where productID, productCode and price in the inventory is the same as those in the product entity.

When a new product is entered in to DB, a new inventory entity also is created with those fields copied from the product entity.

Does any Hibernate mechanism can handle the data synchronization when a product entity is updated? The DB constraint "on update cascade" can deal with unique fields.


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.