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 @Table annotation, database schemas 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 @Table annotation, database schemas" Watch "Hibernate @Table annotation, database schemas" New topic

Hibernate @Table annotation, database schemas

Marcel van der Ven

Joined: Mar 20, 2010
Posts: 14

I am learning hibernate through Netbeans 6.8.
I have created a test database into SQL Server 2008 and want to connect to a table
using a Entity class, this works fine. But when I move my table to a schema and want to use schema names
in Hibernate, Hibernate can not find the table.

I use the annotation:
@Table(name = "Employee", schema = "HR")

Netbeans give me a error on the name and schema keyword, now
when I change name into appliesTo and leave my schema out I get no error but the table can not
be found? I tryed to specify the table name as follows:


but this doesn't work?

I search the Internet and I found on the JBOSS site the @Table page, but there the do not say anything about
schema?? @Table webpage

Does anybody now how to specify a schema in Hibernate?


I agree. Here's the link:
subject: Hibernate @Table annotation, database schemas
It's not a secret anymore!