aspose file tools*
The moose likes Object Relational Mapping and the fly likes problem with @FieldResult, mapping does not seem to work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "problem with @FieldResult, mapping does not seem to work" Watch "problem with @FieldResult, mapping does not seem to work" New topic
Author

problem with @FieldResult, mapping does not seem to work

niels maes
Greenhorn

Joined: Jan 21, 2012
Posts: 2
Hi everyone,

I'm trying to execute the following query:

I expect an id and a lastname to be returned from the query, However only an id is returned.
It seems that the fieldresult annotation does not work.
If I use a different query: select id, lastname from employee, I get the lastname returned.
Below is the complete entity.

Does anyone have an idea what could be wrong?
thanks.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Welcome to the CodeRanch!

Why you haven't mapped the "lastName" column in the entity as with the "firstName" in the first place?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
niels maes
Greenhorn

Joined: Jan 21, 2012
Posts: 2
thanks.

It is just an example to try out the @field_result annotation.
I'm trying out all annotations, originally the mapping was as in your suggestion.
I deliberately changed the mapping/the query to be able to test the field_result annotation.
But I don't understand why it doesn't work.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

I haven't tried this myself (may be later I'll try). But I think persistence provider has no idea of the field being a persistent field. You can verify this perhaps by persisting an entity of this with this code?
 
Don't get me started about those stupid light bulbs.
 
subject: problem with @FieldResult, mapping does not seem to work