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

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?

Related

How to Log DDL and DML in Activiti 7

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.

Eclipse+STS or STS all function invalid

I follow some guide, In the video, Their IDE have all those functions (by default! no config needed):
No auto compile in any type
No Spring entry in "NEW" or "XML Configure File" in XML or anything handy
No Spring XML editor in "OpenWith"
etc....
Almost everything is missing
I try both way: Download STS4 or install STS in Eclipse
None of them working
So: How to get those lost function ?
The tutorial you are following is probably using STS3, which contains all the features for Spring XML config files that you mentioned. However, the tooling that you have installed is Spring Tools 4 for Eclipse, which comes with a different set of features. It supports Spring XML config files, too, but in a different way. It is much more focused on implementing apps on top of Spring Boot. You can find more details in the Spring Tools 4 wiki: https://github.com/spring-projects/sts4/wiki

How to setup JPA console or something similar to execute JPQL queries?

I did lot of web searching before posting the question, but I did not find any working solution yet.
I am developing Spring Boot + Spring Data JPA and Spring Batch project. In this project, I am using JpaPagingItemReader item reader and some custom reader. I am using Repository, Native queries too in order to fetch the data.
I am using JPA Console, but that expects the persistent.context xml file etc., but I dont have that file as I am using Spring Boot.
Is there is any way to execute JPA or JPQL queries which in eclipse/STS which are possible with InteliJ Idea ?

Is there a way to auto-generate hibernate.cfg.xml file in netbeans/eclipse?

Actually i'm learning jpa, so i must learn with examples.
I found that the manual creation of hibernate is annoying,
every time i have to copy and paste the structure of that file
So i was thinking is there any solution to auto-generate the " hibernate.cfg.xml " file automatically via netbeans/eclipse ?
Netbeans automatically generates a hibernate.cfg.xml if you create a Web Application Project that uses Hibernate (see the Netbeans documentation on Using Hibernate in a Web Application). According to this guide, you can also create the hibernate.cfg.xml file using New → Other and then selecting Hibernate Configuration Wizard in the Hibernate group.
In Eclipse, the Hibernate Tools plugin provides a wizard to create the hibernate.cfg.xml file (see the JBoss Hibernate Tools documentation).
Edit: Add information about the file wizard in Netbeans.

Spring IDE / STS : Can I get autocompletions of beans from other files?

When writing XML beans and using "ref=" everything works well as long as beans are declared in one file. But when bean is in other file, I can't get any autocompletion.
Doesn't work in Spring Tools Suite 2.8.1 or Eclipse 3.7.1 with Spring IDE plugin.
Either import the other file or create a config set that groups all the files.
Spring/Eclipse 'referenced bean not found' warning when using <import>?