Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to create a domain class that is NOT mapped to a database table?

Tags:

grails

groovy

I'm using Grails 1.2.1. I'm converting a Java app to a Grails app and I had a Java object that I thought I'd create a grails domain for. However, the object does not rely on an underlying database table. When I startup my app, I'm getting the error,

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: Could not determine type for: java.io.InputStream, at table: http_cache_response, for columns: [org.hibernate.mapping.Column(body)]

Am I misusing the domain? Should this object just be a regular class in src/groovy? Thanks, - Dave

like image 997
Dave Avatar asked Dec 10 '22 09:12

Dave


1 Answers

Yes, domain objects are specifically database-mapped objects. Not domain in the DDD sense.

Depending on if the class is a singleton or not it should either be a service or a class in src/groovy.

like image 200
sourcedelica Avatar answered May 26 '23 19:05

sourcedelica