Consider adding support for a {{NaturalIdClass}} akin to {{IdClass}}. This would allow simplifying the load-by-natural-id API, removing the single/multi component. E.g., consider
{noformat}@Entity @NaturalIdClass(CheckingAccountLocator.class) class CheckingAccount { @Id Integer id; @NaturalId String routingNumber; @NaturalId String accountNumber; }{noformat}
At the moment, loading this by natural-id looks like:
{noformat}Session s = ...; CheckingAccount acct = s.byNaturalId( CheckingAccount.class ) .using( "routingNumber", ... "123" ) .using( "accountNumber", ... "987" ) .load();{noformat}
The locator would allow that to look like:
{noformat}CheckingAccount acct = s.byNaturalId( CheckingAccount.class ) .load( new CheckingAccountLocator( ... "123" , ... "987" ) );{noformat} |
|