The object "User" inside the collection "File" is instantiated. I don't want !
How can I disable the read of a Field on ORMLite ?
You have a couple different ways of solving this.
You can have a
int user_id
field instead of aUser
field and then have a non-database fieldUser
that you hygrade from the database on your own from theuser_id
.Another thing you can do is to use the
queryBuilder.selectColumns(...)
to select all of the columns except theuser_id
column. If you don't return theuser_id
from the select then it won't instantiate aUser
instance. It is important to note that if you mark theuser
field as being a@DatabaseField
, ORMLite will change it touser_id
or something.You could use a
dao.queryForRaw(...)
method and a do the class translation yourself using your ownRawRowMapper
that ignores theuser_id
column in the results.
As an aside, may I ask why you don't want the User
instantiated? Is this a memory issue?