-
Type:
Bug
-
Status: CLOSED
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 10.7, 11.1
-
Component/s: edu-services
-
Labels:
-
11 status:Resolved
-
Conversion Script Required:Yes
-
Test Plan:
Received the following exception when Grading from Assignments.
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
It is generally a good idea to avoid using primitive types and use the related Object (wrapper) for the type that is being stored:
- int use Integer
- boolean use Boolean
- double use Double
and so on
The reason for this is that the database can store a null value but when using a primitive a null cannot be represented, but using the appropriate Object a null can be represented.
- a boolean is TRUE or FALSE
- a Boolean can be NULL, TRUE, or FALSE
In this particular case GradleObject is using table per class inheritance mapping and the sub class Assignment is not allowed to be declared with non null values. This means that primitives should never have been used here because you will likely run into this issue.
Strategy is to switch to using Objects instead of primitives.
This will also change how default values are assigned using the POJO there is no real reason to enforce this at the DDL unless this table is used outside application for other purposes. Meaning enforce defaults in the POJO.
SystemException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
at org.sakaiproject.portal.charon.SkinnableCharonPortal.doGet(SkinnableCharonPortal.java:901)
caused by: org.sakaiproject.tool.api.ToolException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1544)
caused by: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
caused by: org.springframework.orm.hibernate3.HibernateSystemException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of org.sakaiproject.tool.gradebook.Assignment.externallyMaintained
at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:583)
caused by: java.lang.IllegalArgumentException
at sun.reflect.GeneratedMethodAccessor1765.invoke(null:-1)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:66)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:583)
at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:229)
at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3848)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:152)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982)
at org.hibernate.loader.Loader.doQuery(Loader.java:857)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3294)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:269)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1038)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:630)
at org.hibernate.type.EntityType.resolve(EntityType.java:438)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982)
at org.hibernate.loader.Loader.doQuery(Loader.java:857)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)