I have an Mapped object that has several @Formula mappings in it. In most of the places, the mapped formulas are not needed, but the queries are involved and so when fetching a list of objects, it's really slowing the query down.
I want to move all the @Formula mappings to a separate object. So if the mapped object is, say, a User, the new object would be UserFormula and really only need a member var of User to map it back to the User object.
It would be one-to-one.
To make a traditional mapping, however, I'd need to create a table called UserFormula with just the single FK reference back to user (so PK and then USER_ID). That seems lame. Is there a way to create the UserFormula object without having to make it mapped? Or is there a way to not fire the @Formula fields on queries unless expressly asked for? I looked at naming each field in the query and simply omitting the @Formula fields. That's all I can think of. I was hoping that having a separate object of the @Formula fields would just let me fetch that only when needed.
Thanks
|