I'm trying to reuse some of the entity classes with JPA-annotations in my project. But unfortunately I'm newbie in Hibernate & JPA too. When I try to generate controllers with command "grails generate-all" I get error:
Error running generate-all: 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.PropertyNotFoundException: Could not find a setter for property version in class example.MyBean
There is very simple solution: add field 'version' with getter/setter pair. But I don't want to change my entity classes, because may be I'll want to reuse them in some other non-grails projects. Is there a way to use together JPA annotations with hibernate mapping files, without duplication already used annotations in entity classes?
Yes, and also, is this a good idea or there is some better approach?