Yes, or since you are using Hibernate/JPA annotations, the factoryBean has a property for "packagesToScan" which scans those packages for Annotated classes, there is also another property to use to list out the classes I forget what it was called, probably "mappedClasses"
I prefer to use the packagesToScan since that list will be smaller than the list in mappedClasses.
Tommy, he is not using xml mapping, he is using Annotation mapping. So you example will not work for him. He is just setting the wrong property in the AnnotationSessionFactoryBean.
Mark Spritzler wrote:Tommy, he is not using xml mapping, he is using Annotation mapping. So you example will not work for him. He is just setting the wrong property in the AnnotationSessionFactoryBean.
Mark
Well, based on the exception "Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'mappingResources' of bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:
Bean property 'mappingResources' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?"
I can tell that "mappingResources" is not proper configured, the app looking for a resources, but it can not find due not configure correctly. Whether using Annotation mapping or not doesn't matter since, the error indicated at configuration level not application level error.
If you look carefully and check Spring document you'll find out the "mappingResources" is not configured correctly.
You can recreate the problem and confirm, I'll try and see if that's the problem or there are other problems.
@ali honarmand
Could you tell what's your status and did you get the problem solved?
OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
Mark Spritzler wrote:Tommy, he is not using xml mapping, he is using Annotation mapping. So you example will not work for him. He is just setting the wrong property in the AnnotationSessionFactoryBean.
Mark
Well, based on the exception "Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'mappingResources' of bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:
Bean property 'mappingResources' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?"
I can tell that "mappingResources" is not proper configured, the app looking for a resources, but it can not find due not configure correctly. Whether using Annotation mapping or not doesn't matter since, the error indicated at configuration level not application level error.
If you look carefully and check Spring document you'll find out the "mappingResources" is not configured correctly.
You can recreate the problem and confirm, I'll try and see if that's the problem or there are other problems.
@ali honarmand
Could you tell what's your status and did you get the problem solved?
Yes, but he shouldn't even be setting or using the mappingResource property in his configuration. He needs to remove it and use the correct property.