-->
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.  [ 5 posts ] 
Author Message
 Post subject: Where can i get the example, i am the new beginner
PostPosted: Sat Jan 03, 2004 9:01 am 
Newbie

Joined: Thu Dec 04, 2003 12:13 am
Posts: 3
Location: Malaysia
now i know how to use one-to-one, many-to-one, many-to-many, but i dont know how to search a record.
where can i get the example for this?
....
i read the documentation before, but i dont understant.
select cat from CAt as cat,
what is cat and what is Cat?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 9:35 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
cat is an alias (shortname) as it is on SQL : you set it and use it in the query, Cat is the mapped class (you can use full name of the class too: eg.Cat).

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 9:53 am 
Newbie

Joined: Thu Dec 04, 2003 12:13 am
Posts: 3
Location: Malaysia
thanks for helping.
.......

for example, i have 2 class in one2one relation
Student.java and Address.java

Student.java
-- id
-- name

Address
-- id
-- name

how can i retrieve the record?
in sql, that is simple,
select * from student where addre='? ';

but in hql....

actually, i'm not very good in sql language. i learn java just 2 months only. java is oo but mysql not, so i search some information from internet, then i know O/R mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 10:50 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
from Student as student where  student.address = :address

where :address is a named parameter.
Notice the dot between student and address. This is an Object oriented query language.

I suggest you to read the Hibernate reference guide tons of time and play with very simple example. This is the best way to learn. You'll find the reference guide difficult and obscure. Actually it's very rich and it takes time to understand everything (I still learn when I read it).
Have a look at the External ducmentation, especially tutorials.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2004 11:04 am 
Newbie

Joined: Thu Dec 04, 2003 12:13 am
Posts: 3
Location: Malaysia
Thank you very much.
i will study the reference document and try to find some case study.


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