aspose file tools*
The moose likes Object Relational Mapping and the fly likes Insert, update row in table have many to one and one to many Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Insert, update row in table have many to one and one to many" Watch "Insert, update row in table have many to one and one to many" New topic
Author

Insert, update row in table have many to one and one to many

Minh Phuc
Greenhorn

Joined: Aug 07, 2012
Posts: 9
I have 3 entities which mirror from 3 tables in database. The first entity named Khachhang


The 2nd entity named MaSoThuong:


The 3rd entity named ThamDu


and the entity are generated automatically


How can I insert or update table ThamDu?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

Moving to the ORM forum.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

I don't see any @Entity annotations on them. You can persist and update them using an EntityManager.


[How To Ask Questions][Read before you PM me]
Minh Phuc
Greenhorn

Joined: Aug 07, 2012
Posts: 9
Bill Gorder wrote:I don't see any @Entity annotations on them. You can persist and update them using an EntityManager.

There are entities, I don't want post long code. Somebody suggest?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

You asked how to save or update it. I said you save or update entities using an EntityManager which must be configured. Was that your question or are you saying that when persisting or updating the entity you are getting an exception that you neglected to post? If that is the case please TellTheDetails.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Insert, update row in table have many to one and one to many
 
Similar Threads
No mapped data?
Problem retrieving data from relational databse using persistence
How to Write Left Outer Join
JPA - need help with query
JPA2.0 CascadeType.ALL doesn't cascade persist