Hello there,
Need help with some specific HQL queries and / or better techniques for Hibernate / JPA.
Created three JPA annotated classes:
(1) User:
(2) Device:
(3) Token
Details / Schema Info:
* User and Device contain a bi-directional one-to-one mapping.
* User contains a foreign key (device_id) connecting to Device's primary key.
* Device and Token contain a bi-directional one-to-one mapping.
* Device contains a foreign key (token_id) connecting to Token's primary key.
What I need help with is figuring out these following conditions where I think I could only do using HQL...
Am trying to create two methods in a utility class that does this:
(1) Insert
string into the token.value (table.row notation) where user and device are joined by their ids.
This throws the following error:
(2) I need my next query to match the following conditions:
- Token currently exists (which I think I did by issuing token != null)
- A query or logic which checks if the Token.id matches specified Device.token_id (how can I do this?, I tried the SELECT statement but I am not sure about it)?
Would really appreciate it if someone could help me with these HQL queries (I couldn't find a good reference on HQL which gave an example using INSERT INTO).
Happy programming and thanks!
-James