Discussion:
[jboss-user] [jBPM] - Invalid JPA definition for ProcessInstanceLog v5.4.0, leads to Hibernate exception
Julien Serdaru
2013-01-29 21:24:09 UTC
Permalink
Julien Serdaru [https://community.jboss.org/people/jserdaru] created the discussion

"Invalid JPA definition for ProcessInstanceLog v5.4.0, leads to Hibernate exception"

To view the discussion, visit: https://community.jboss.org/message/795008#795008

--------------------------------------------------------------
Hello, there. I see that the ProcessInstanceLog class has been modified between 5.3.0 and 5.4.0. The following persistent properties have been added:

@Column(nullable=true)private int status;@Column(nullable=true)private long parentProcessInstanceId;@Column(nullable=true)private String outcome;

However, I think having a nullable property with a primitive type is not going to work when loading data with the "parentProcessInstanceId" or "status" having null values (which happens in my case).

Hibernate complains:

Caused by: java.lang.IllegalArgumentException: *Can not set long field org.jbpm.process.audit.ProcessInstanceLog.parentProcessInstanceId to null value*
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
    at sun.reflect.UnsafeLongFieldAccessorImpl.set(UnsafeLongFieldAccessorImpl.java:62)
    at java.lang.reflect.Field.set(Field.java:657)
    at *org.hibernate.property.DirectPropertyAccessor$DirectSetter*.set(DirectPropertyAccessor.java:139)

I think a simple fix would be to substitute int with Integer, long with Long, and modifiy the setter/getter methods accordingly.

Am i the only one with the problem? Should I open an issue on Jira?

Thanks for your help.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/795008#795008]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-30 17:35:45 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Invalid JPA definition for ProcessInstanceLog v5.4.0, leads to Hibernate exception"

To view the discussion, visit: https://community.jboss.org/message/795232#795232

--------------------------------------------------------------
haven't seen this at all and all tests we have would complain about it I think. Anyway what hibernate version do you use? Do you have it in custom application or you use with jbpm-console? And last question how do you load that logs?

Cheers
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/795232#795232]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Julien Serdaru
2013-02-06 22:09:26 UTC
Permalink
Julien Serdaru [https://community.jboss.org/people/jserdaru] created the discussion

"Re: Invalid JPA definition for ProcessInstanceLog v5.4.0, leads to Hibernate exception"

To view the discussion, visit: https://community.jboss.org/message/796420#796420

--------------------------------------------------------------
Sorry just saw that, it seems the notification skipped my inbox.

I use hibernate 4.1.7, not through jbpm-console.
Are you saying that those two new fields are never supposed to be null? If that's the case, then I might have to track down the problem. If not, then there is definitely a mapping problem as you wouldn't be able to persist a null primitive type with this mapping.

Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796420#796420]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-02-07 14:55:37 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Invalid JPA definition for ProcessInstanceLog v5.4.0, leads to Hibernate exception"

To view the discussion, visit: https://community.jboss.org/message/796541#796541

--------------------------------------------------------------
in general, since they are primitives they will never be null as they get the default value for it's type. Nevertheless the idea behind it was to support null so please file a jira issue for it to make them as objects instead of primitives. I think the case where you would encounter it is when you have existing db will data and you upgrade that table and these values are null then by default. In that case it fails, is that what you ran into?

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796541#796541]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...