I have this code:
Code:
Query query = session.createQuery("from Choice where text = :choiceText");
query.setString("choiceText", choice.getText());
Choice dbChoice = (Choice) query.uniqueResult();
And I get this exception:
Quote:
Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: aftectest.Choice
Has anyone else seen this? This makes absolutely no sense to me - the exception seems to be saying that the Query object itself is referencing an unsaved transient instance...which doesn't make any sense because how it retrieve a unsaved object by doing a query against the database?