WISE-Community / WISE-DEPRECATED

Web-based Inquiry Science Environment (WISE).
http://wise.berkeley.edu
Other
32 stars 24 forks source link

db init script contains constraints that are not consistent with code #1859

Closed hirokiterashima closed 5 years ago

hirokiterashima commented 5 years ago

Description

For Event.java, project field is nullable in the code (https://github.com/WISE-Community/WISE/blob/76e43be7d4409850aae5ac7a137771090c1f86b2/src/main/java/org/wise/vle/domain/work/Event.java#L69)

but is not nullable in db-init.sql: https://github.com/WISE-Community/WISE/blob/8cca2ad60fbff9976708466b71bd958e27dab6ee/src/main/resources/wise_db_init.sql#L147

This causes problems when inserting/updating events, like when creating a new project in the Authoring Tool.


2019-03-21 17:02:13.046 ERROR 14757 --- [io-8080-exec-10] o.h.e.j.s.SqlExceptionHelper             : Column 'projectId' cannot be null
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:241)
    at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:364)
    at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:328)
    at org.springframework.orm.hibernate5.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:706)
    at org.wise.portal.dao.impl.AbstractHibernateDao.save(AbstractHibernateDao.java:54)
    at org.wise.portal.dao.impl.AbstractHibernateDao$$FastClassBySpringCGLIB$$c3607d72.invoke(<generated>)
aperritano commented 5 years ago

this looks great!

hirokiterashima commented 5 years ago

Thanks @Tony I assigned the PR #1865 to you. Can you review and merge to develop if all looks good?