Hibernate scenario:
@Embeddable
public class CompositeKey...{
private String keyPart1;
private String keyPart2;
}
public class Entity{
@Embedded
private CompositeKey cKey;
...
}
Now when running this with a cKey with a value in only keyPart1 and keyPart2 == null I get a "binding null to parameter n" binding null to keyPart2.
Can I avoid that and have hibernate generate an SQL with only the parameters that actually has a value and omit the null ones?
So instead of
where keyPart1 = ? and keyPart2 = ?
I just want
where keyPart1 = ?
if cKey.keyPart2 == null
Thanks in advance...
./CJ