Forums Register Login

Defining custom query for properties

+Pie Number of slices to send: Send
Hi to all,
I'm trying to map my beans to a *very* weird and complicated database schema and the annotations are just not enough some times; is it possible to define custom queries for accessing the properties (at this point I'm interested in read only behavior).

I'd like something like

@Entity
{ ...

@MyCustomQuery(....)
public Set getSomething() {}
}

If I'm not mistaken, Hibernate 2.1 allowed a similar definition in the xml.

I'd really like to avoid having to add the query code inside my entity...

Regards
[ January 21, 2008: Message edited by: Alejandro Dominguez ]
+Pie Number of slices to send: Send
a bit costly, but you can certainly do it with code inside the accessor,
an annotation might be convenient, but it's not necessary,
+Pie Number of slices to send: Send
I see; the logical next question is then: can I inject a PersistenContext into a @Entity?
I tried doing so, but it is always null...

Regards
Popeye has his spinach. I have this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 675 times.
Similar Threads
Value List Handle Pattern
Read-only view entities
building a search feature in my application, what is the best approach
Hibernate Querys.
HQL: entity/entities in set of entities
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:11:50.