• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

questions about Hibernate

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Hibernate.
And I have a questions about using "schema.table".

For example, I have a database named DB.
And I want to store different schools data in it.
I use school number as schema.

I've done this using DB2 and Oracle with SQL (in a jsp or JavaBean),
for instance, "select schoolname from " + schoolNum + ".schooldata",
but I don't know how to do the same function with Hibernate.

Any ideals?
Thanks a lot.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate Query Language (HQL) is very like SQL - there are a few syntactical differences, but generally they are pretty much the same. So you can write queries which will look familiar:

for example, which selects the property "mate" from the table "eg.Cat". The big difference between the two, which I think is what you are looking for, is you can follow the path of joins through the name of the property you select, for example:

which would select the property telephone, from the table address (presuming there are mapped joins between class, student and address).

Hibernate also allows straight SQL queries with the createSQLQuery method. SO you can still run SQL as you understand, however you remove the ablility for Hibernate to be truely portable if you do that.
[ June 02, 2004: Message edited by: Paul Sturrock ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic