Thanks Rahul for the help. But the User table has a foreign key to the UserTheme table. I think I'll have to modify the User and UserTheme classes to use PrimaryKeyJointColumn to make the sql statement work. Or I can use the JPA solution given by Jaikiran. So I think I have two possible solutions which puts me in a comfortable state
. Thanks Rahul and Jaikiran for the help