I am being plagued by an
org.hibernate.TransientObjectException
using Grails 2.3.9 and Grails Hibernate 3 Plugin 3.6.10.15
Here's the specific issue:
I have a domain class called Pencil and a domain class Backpack with a many-to-many relationship:
Pencil{
PencilType type
Location location
Date creationDate
String description
int position
boolean active
static hasMany = [backpacks: BackPack]
static belongTo = [backpacks: BackPack]
static constraints = { .... all nullable ..... }
}
BackPack{
Color color
int size
static hasMany = [pencils: Pencil]
static belongsTo = [pencils: Pencil]
static constraints = { .... all nullable ..... }
}
If I create and save a pencil, I cannot save without getting the:
org.hibernate.TransientObject Exception
Message: object references an unsaved transient instance - save the transient instance before flushing: Pencil
This occurs even when creating a blank pencil object.
new Pencil().save()
--UPDATE-- **Problem occurs using both Hibernate3 and Hibernate4 Grails plugin.