Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Object Relational Mapping
hibernate best start sample
Alvin chew
Ranch Hand
Posts: 834
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi, i'm new in hibernate, just wondering is there any expert here know the simplest sample code for hibernate that we can review, say for example, sample of get table's data (like select col1, col2 from mytable)
thank you very much for guiding
miguel lisboa
Ranch Hand
Posts: 1282
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
in first place let me state i'm no pro at all;
hibernate query language (hql) is very similar to sql but queries objects instead
let's see an example:
public class Person{ private Long id; private String nomePerson; private String palavraPasse; //accessors
String query = "SELECT p from Person as p " + "WHERE p.palavraPasse = :-P alavraPasse " + "AND p.nomePerson = :nomePerson"; Query q = sess.createQuery ( query ); q.setString ( "palavraPasse", palavraPasse ); q.setString ( "nomePerson", nomePerson ); List lista = q.list (); Person p = ( Person ) lista.get ( 0 ); // process Person String personName = p.getNomePerson();
anyway hibernate site and hibernate docs have valuable info and examples; you also might want to try Hibernate In Action book
hope this helps
java amateur
I once met a man from Nantucket. He had a tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
hibernate lucene integration sample projects
Spring 3.0 And Hibernate annotations.
Hibernate example
problem in hibernate code
Transparent Persistence
More...