tags:

views:

360

answers:

1

Hey

I have a bean with a certain field f1 that should not be mapped into the table , but sometime I do want to load it from some queries (not the table itself)

Can it be done? How?

I've tried declaring it @Transient , but then it doesn't read it from the query , even when I declare <return-property name="f1" column="f1"/>

Thanks!

+1  A: 

Try mapping it like normal but setting insert and update to false. Or, you could define it as a formula that just has the column name in the formula. Hibernate will query it just fine but will know not to try to write it.

Brian Deterling
Insertable = false and updateable = false will still cause hibernate to try to read it from the table - and I don't want it. (Also , there's no readable = false)About the formula - Good idea , but it won't work - because the result is based on other fields in the query , which are not in the table
yossale
I guess I misunderstood the question. You might try adding more details or a concrete example. Good luck!
Brian Deterling