Wednesday, December 26, 2012

hibernate error: path expected for join

To ORM (Object Relational Mapping), a path is a reference inside the target object that leads to its respective associations.

For instance, this WRONG HQL statement:

select prod.nome, cat.nome from ProductVO as prod join CategoryVO as cat

causes the exception:

app.exception.DaoException: [SYSTEM]: Path expected for join! [select prod.nome, cat.nome from app.model.persistence.hbn.vo.ProductVO as prod join
CategoryVO as cat]


The mistake is that the statement was created thinking as it were SQL way of doing things.

But, the ORM way of doing things is:

select prod.nome, cat.nome from ProductVO as prod join prod.CategoryVO as cat

The path is supplied by prod.CategoryVO as cat, which is the referenced object.

No comments:

Post a Comment