List<Number> list =
em.createQuery("select number from Number number where number.phone in (:numberList)")
.setParameter("numberList", thisIsAList<Number> .getResultList();
When I change the "where number.phone" portion of the query to "where number" I get a object references an unsaved transient instance - save the transient instance before flushing: Number error
Thank you all for your time
[ July 16, 2008: Message edited by: john mattucci ]
Originally posted by john mattucci:
There is no such method in javax.persistence.Query. If I change the list to contain Strings and the leave the "where number.phone" portion as is it works. What I'm trying to do is check if the numbers already exist in the DB. My question now is can I attempt what I'm trying to do i.e. use the Number object to see if the data is the DB or is it trying to tell me that I cannot do that unless that data is first present in the DB?
I guess you can think of it this way, if you just use Number in the Where, how is that going to be translated to an SQL query to pass to the database. Include all the fields of the object in the where? Does sound very effective.
In Hibernate, not JPA there is the Criteria object, where you can use an Object with some data filled as an example to create a where clause with just the fields that have values.