views:

196

answers:

1

I don't see anything in the official documentation about unsupported persistence data types, so I'm working under the assumption that types available in the Groovy language should be handled. However, for the following domain class:

class DocGroupPermissions {

Workgroup workgroup;
Document document;
BitSet permissions = new BitSet(2)
public DocGroupPermissions() {}

void setPermissions(boolean canRead, boolean canWrite){
    setReadPermissions(canRead)
    setWritePermissions(canWrite)
}
BitSet getPermissions()
{
    return permissions
}
void setReadPermissions(boolean canRead)
{
    permissions.set(0,canRead)
}
void setWritePermissions(boolean canWrite)
{
    permissions.set(1,canWrite)
}

boolean getReadPermissions()
{
    return permissions.get(0)
}

boolean getWritePermissions()
{
    return permissions.get(1)
}


static belongsTo = [workgroup:Workgroup, document:Document]
static constraints = {
    workgroup(nullable:false, blank:false)
    document(nullable:false, blank:false)
}

}

I'm getting:

2009-11-15 16:46:12,298 [main] ERROR context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table doc_group_permissions refers to an unmapped class: java.util.BitSet

Has anyone run into this before?

A: 

Not all types are mapped - I think this is more of an issue from hibernate side, actually (the ORM layer needs to know how to persist the objects it doesn't know about).

Check out the joda-time plugin, it comes with a special library that maps the joda Dates classes to hibernate, and then you have to specify it in mapping closure.

You should try to see if somebody wrote a hibernate persister for BitSet, or try to use a different class.

Jean Barmash
Do you or anyone happen to know where to find an official set of GORM mapped types?
Visionary Software Solutions