views:

74

answers:

1

Hi all

I have a sql query in formula tag inside property tag.

In that query i am creating alias name but the hibernate appends table name and throwing me error.

select sum(e.salary) as sal from employee e

but hibernate changes to

select sum(e.salary) as employee.sal from employee e

how to avoid this ....

it should recognise as sal inside of employee.sal !!!

A: 

Why don't you just declare:

<property name="salary" type="integer"
formula="( select sum(e.salary) from employee e )">
</property>

What's the point of the alias?

Pascal Thivent