File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate\JPA set field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate\JPA set field" Watch "Hibernate\JPA set field" New topic

Hibernate\JPA set field

Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208

i have a field "topicId" that i set the id of the topic,

i use a filter to set the current topic id when doing queries,

but is there anything to set the topicId when doing inserts and updates?


Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

I don't understand why you would need to set the id on an insert or update. Would these not be generated? Also you typically do not write insert or update queries you just modify the entity and when the transaction is committed hibernate will generate the appropriate update or insert query.

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Hibernate\JPA set field
jQuery in Action, 3rd edition