Hello,
I starting to manipulate Hibernate with a simple database, and in particular I'm working with criteria API on Eclipse.
My database is only composed of 3 tables:
Code:
Author
number
name
Book
number
title
year
WrittenBy
author_num
book_num
I created config file, generated the HBM files and java code.
Code:
public class Author implements java.io.Serializable
{
private int number;
private String name;
private Set books = new HashSet(0);
...
}
public class Book implements java.io.Serializable
{
private int number;
private String title;
private Short year;
private Set authors = new HashSet(0);
...
}
I started working with criteria with easy requests on 1 table: working with restriction, projection, order...
Everything's fine.
But now, I'm interrogating 2 tables and it doesn't work.
This is for instance what I tested
Code:
Criteria c1=session.createCriteria(Book.class);
Criteria c2=c1.createCriteria("authors");
c2.add(Restrictions.ilike("name", "%erg%"));
list=c1.list();
and this what I received
Quote:
Caused by: org.postgresql.util.PSQLException: ERROR: relation "authors" does not exist
Any idea ? because everything seems to be declared normally ![/code]