aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to know whether a particular row exists in table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to know whether a particular row exists in table" Watch "How to know whether a particular row exists in table" New topic
Author

How to know whether a particular row exists in table

chandrakanth boga
Ranch Hand

Joined: Mar 15, 2006
Posts: 49
I have a Table USTCOLOR which has two colomns project_reference and Color_Codes.

How do i find a particular project reference exists in the table or not?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Are you using an ORM for this? If so, which one?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
chandrakanth boga
Ranch Hand

Joined: Mar 15, 2006
Posts: 49
Yes...I am using Hibernate
chandrakanth boga
Ranch Hand

Joined: Mar 15, 2006
Posts: 49
I am using Oracle database
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Well you can get it by its primary key or look it up via a query. See the Session interface and its various get and createQuery methods.
chandrakanth boga
Ranch Hand

Joined: Mar 15, 2006
Posts: 49
thanks for the information paul.....But i am completely new with the Hibernate...I really some code stuff...
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi,

if you are new to Hibernate take look at Java Persistence with Hibernate - Chapter 2 for a deeper understanding. There search for createQuery.

Regards,
Darya


SCJP, SCJD, SCWCD, SCBCD
 
 
subject: How to know whether a particular row exists in table