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!
From stackoverflow
-
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.
yossale : 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 tableBrian Deterling : I guess I misunderstood the question. You might try adding more details or a concrete example. Good luck!
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.