0

I have a JBPM application whose object model is Java 11 classes using Hibernate tags, JPA2 and JDBC for persistence with an SQL Server database at 2014 compatibility.

The application has been working for about a year and I am upgrading to JBoss EAP 7.4 using a new installation. During this process, a class storing LocalDateTime fields is having each such field converted to a varbinary(8000) - which is throwing an exception by SQL Server.

The persistence is specified by Hibernate tags and Hibernate properties in the JBPM application. An example of the field tagging is:

@javax.persistence.Column(name = "DATE_COMPLETED", columnDefinition="datetime2")
private java.time.LocalDateTime dateCompleted;

I realize that the columnDefinition is used only with the DDL so I enabled

hibernate.hbm2ddl.auto=create-drop

which I would can't have in non-development environments and the INSERT's still use varbinary(8000). I am using mssql-jdbc-9.2.1.jre8.jar for the JBoss module connectivity and will try using other JDBC drivers.

How can I get the LocalDateTime to correctly map to a datetime2 in the database? I can't change the datatypes of the fields due other logic in the system. This stackoverflow question implies that my Hibernate

<dependency>   
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-envers</artifactId>
        <version>5.6.5.Final</version>      
        <scope>provided</scope>
</dependency>

May be getting overridden as PAM/JBPM runs. Within Business Central hibernate-core is a dependency at 5.6.5-Final for the application and hibernate-commons-annotations is version 5.1.2-Final.

I am not sure how to get a detailed dependency tree of the kie-server war executing my project's kjar (jar file with an additional configuration file) - if that is the route to debug this.

Dr Dave
  • 550
  • 1
  • 6
  • 22
  • Which specific version of JPA 2 are you using? JPA 2.2 and later support LocalDate and LocalDateTime classes, JPA 2.1 and earlier require attribute converters for them. – AlwaysLearning Mar 20 '22 at 12:21
  • As the latest version of RedHat's tool (and earlier versions worked with the LocalDateTime) I believe it is supposed to be using at least version 2.2. I will search to see if something in the JBOSS EAP 7.4 standalone.xml configuration file cause it to revert to an earlier version of JPA. – Dr Dave Mar 21 '22 at 12:44
  • I see the dependency for javax.persistence-api verison 2.2 defined under persistence. – Dr Dave Mar 21 '22 at 13:15
  • Interesting...this is in the JBoss console - so how do I configure JBoss to use JPA 2.2? Manages the Java Persistence API (JPA) 2.1 container-managed requirements and allows you to deploy persistent unit definitions, annotations, and descriptors. – Dr Dave Mar 21 '22 at 14:18

0 Answers0