Hibernate version: 3.2
Hi I am using hibernate 3.2 to map my objects with my oracle database and I am using annotations.
my question is :
Can I use in my object, variable that does not bind a column ?
let me explain a bit :)
I have an object Actrivity which binds an oracle table.
This table has 2 fields: id, mode.
I declare the first variable as the following:
@Column(name="id")
Double id;
I do not want hibernate loads this second field but I want to be able to use the variable
Double mode;
finally I want to use a boolean flag which is not a table field
boolean myFlag;
Here is the behavior I get and seems a bit strange to me.
'id' is loaded and I can get the value with the getter : ok
'mode' is loaded despite I did not write '@Column(name="mode")'
'myFlag' rises an ORA 00904 exception which is : the column 'myFlag' does not exist
so is it possible hibernate loads automatically the field declared in the classe ?
how to avoid that ?
The behavior I would like/expect is : only the variables declared to be bind (with the @annotation) should be loaded !
and how to use a class variable which is not a table field without getting an error ?
thanks for your help
Here is the stacktrace
org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2214) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095) at org.hibernate.loader.Loader.list(Loader.java:2090) at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:888) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at com.aureus_pharma.saio.core.Activity.retrieveActivitiesFromIdTargetList(Activity.java:270) at com.aureus_pharma.profiler.ProfilerControler.launchTargetQuery(ProfilerControler.java:750) at com.aureus_pharma.profiler.query.TargetPane$1.run(TargetPane.java:218) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: ORA-00904: "ACTIVITY0_"."myFlag" : identificateur non valide
database : Oracle 9i
|