How to Log DDL and DML in Activiti 7 - spring-data-jpa

I'm looking for help on how to log bootstrap DDL and runtime DML statements with Activiti Core 7.7.0 and Spring Boot 2.7.7. According to comments on this question, I simply need to enable hibernate SQL logging, which I've attempted to do in my application properties. Here's the "STDOUT" approach I've tried:
spring.datasource.url=jdbc:h2:./data/activiti-engine
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.show_sql=true
...and here's the "Java Logger" approach I've tried:
spring.datasource.url=jdbc:h2:./data/activiti-engine
spring.jpa.hibernate.ddl-auto=update
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
Neither approach produces SQL statements in the console.
It's clear to me that Activiti is picking up the datasource.url and ddl-auto properties, as the file-based database contains tables, and the ACT_PROCDEF_INFO table has rows for each BPMN file I've stored in src/main/resources/processes. I just don't see the SQL statements that are producing all this work.
I should point out that I've declared neither a logback nor a log4j configuration file, so I'm seeing the default logging levels printed to the console. Plenty of log output appears in the console, but no SQL.

Activiti does not appear to use Hibernate. mvn dependency:tree shows no hibernate dependencies for org.activiti:activiti-spring-boot-starter:jar:7.8.0, but rather a dependency on org.mybatis:mybatis:jar:3.5.10. This is confirmed in the documentation for the previous major version of Activiti (6.0.0).
Later in that documentation, there's mention of using JPA with org.activiti:activiti-spring-boot-starter-jpa, but it doesn't appear that artifact has moved forward into 7.x. Maven central's latest versions are either 6.0.0 or 5.23.0, and the Alfresco Nexus does not have any versions of this artifact.

Related

Spring Roo. Deleting .aj archives without generating new ones

I have installed the Roo Shell 2.0.0.RELEASE in my eclipse. I have never worked with Roo, but, as I understood, it will regenerate the .aj files of my imported roo project when I modify something in them.
However, when you open the projects, it just delete the .aj with commands like this:
roo> Deleted SRC_MAIN_JAVA\com\bbva\front\oorg\cirbe\cirbedaos\dto\vinculaciones\DetalleVinculacionesDaoOutDto_Roo_JavaBean.aj - not required for governor com.bbva.front.oorg.cirbe.cirbedaos.dto.vinculaciones.DetalleVinculacionesDaoOutDto
I don't know if I should write or configure something else, since most manuals I see only say that the Shell should generate these files automatically. Any idea about what im missing?
Indicate that I think the project used to work with shell 1.1.5 (i imported an existing project), but I was unable to open it, so I used 2.0.0. It is assumed that Roo has also updated this in the POM files:
Updated ROOT\pom.xml [updated property 'roo.version' to '2.0.0.RELEASE'; updated property 'roo.version' to '2.0.0.RELEASE']
Spring Roo uses the annotations included in your .java files to generate the .aj files. Each version of Spring Roo could provide/deprecate different annotations. Spring Roo 2.x is a major update, and it does not support some of the annotations of Spring Roo 1.x
https://docs.spring.io/spring-roo/docs/current/reference/html/#no-backward-compatibility
As you said, the project was created with the 1.x version of Spring Roo, so the generated code included annotations that are not supported by the 2.x version of Spring Roo. That is the reason because your .aj files are being removed with the message not required for governor.
Also, I guess that a warning message appeared to you in the Spring Roo shell before to open the project.
Hope it helps.

Does Spring Data JPA internally use Hibernate & why my app is working if I am not giving dialect property?

I just started learning Spring Data JPA, I connected to mysql in localhost and able to save a record but I am unable to understand why it is working if I am not giving dialect property in properties file and is hibernate a default implementation of spring data instead of ibatis or Eclispe link, because in my pom.xml I just added the dependency of spring-data-jpa and never mentioned what kind of JPA implementation I want to use.
application.properties
spring.jpa.hibernate.ddl-auto=create
spring.jpa.properties.hibernate.
spring.datasource.url=jdbc:mysql://localhost:3306/initsoftware
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=ppppppp
spring.datasource.password=xxxxxxx
logging.level.root=DEBUG
spring.jpa.show-sql=true
Since you have an application.properties I assume you are using Spring Boot and not just Spring Data JPA.
In order to use JPA with Spring Boot you would typically add spring-boot-starter-data-jpa to your dependencies. This indeed comes with Hibernate out of the box as you can see when you inspect the dependencies.
Spring Data JPA itself doesn't come with a JPA implementation. You have to add that.
iBatis is not a JPA implementation.
If the assumption above doesn't match your scenario you can use the maven dependency plugin to inspect your (transient) dependencies. The following is a good starting point.
mvn dependency:tree -Dverbose
If you use a different build tool, it probably has a similar feature.

Tool to test HQL queries - Hibernate+Spring+Annotations+Maven

Is there a way to test HQL queries from Hibernate project integrated with Spring?
I came across JBoss tools for eclipse, but unable to configure it as it is expecting hibernate.cfg.xml file as input, whereas we had all our configuration in hibernateContext.xml file and annotations were used instead of .hbm files.
Any ideas please?

Configuring NetBeans 7.3 JPQL editor?

I have a RESTful service that builds and runs fine. However, when I try to use the JPQL editor, it gives the error:
java.lang.Exception: You need to add your persistence provider library either to project classpath or registed as Ant Library within Netbeans
You need to register database connection on Services tab
I'm using EclipseLink 2.4.1 as my persistence library, and I already have a library added in the Ant manager as "EclipseLink 2.4." When that failed, I made a library called "EclipseLink (JPA 2.0)(default)" to match the persistence.xml GUI name for it. I even tried creating a library named "org.eclipse.persistence.jpa.PersistenceProvider. All failed and now I'm stumped.
I have a connection the SQL Server database I'm using and it works fine.
I really am unsure of what I need to do to get this working. The editor seems like it would be a great boon, but there doesn't seem to be much documentation on it, nor questions with problems similar to mine. If anybody can help, that would be great.

EclipseLink Annotations cannot be resolved

I'm trying to create a simple EclipseLink POC. Unfortunately, it doesn't seem to include important, basic classes within the JAR.
For example, the following fails within eclipse (and eclipselink is definitely on the build path): import javax.persistence.Id. Should I have a basic-JPA-functionality jar as well? Are annotations stored somewhere else within eclipselink (I've looked, can't find anything)? What am I missing?
Thanks
API part is missing. Name of jar is javax.persistence_1.0.0.jar. In EclipseLink 2.4.1 (http://www.eclipse.org/eclipselink/downloads/index.php#2.4 Installer zip) download it is located to eclipselink/jlib/jpa/javax.persistence_1.0.0.jar.