From: Valentin C. (JIRA) <no...@at...> - 2006-06-19 10:27:33
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HB-156?page=comments#action_23355 ] Valentin Chira commented on HB-156: ----------------------------------- the where helps you only if your value is hardcoded. but what if for example in the where i wanna write something dinamicaly generated like where CLASS_NAME = "<here insert the class name>" or in the value I wanna have the result of some static method call. Does this work? the idea is that i don't want to load all elements in the relation table but only the ones that have some column value like some dinamic value.thx. > Qualified one-to-many > --------------------- > > Key: HB-156 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-156 > Project: Hibernate2 > Type: New Feature > Versions: 2.0.1 > Reporter: TURIN ACCOUNT > Priority: Minor > > > Ability to add static criteria to what would otherwise be a one-to-many relationship, to > make it into a one-to-one relationship. Example: Account has one-to-many relationship to > Address by way of address.account_id foreign key. However, there is only one "primary" > address for a given account, indicated in the datamodel by address.is_primary = 'Y' for > exactly one row for any given Account. Enhancement would let me create a property > "primaryAddress" on Account that is mapped like a one-to-many except that it also includes > something like "...AND primary = true". > > This allows me to obtain an Account object and call getPrimaryAddress and have that SQL > query the address table "WHERE account_id = ? AND is_primary = 'Y'". > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |