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

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 ?

Related

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.

Spring boot with shared JavaEE entities jar

I got a problem where I'm not able to find a solution.
We got a shared library with all entities which are setup to use with JavaEE 6 entities (Websphere). So mapping is based on the JavaEE 6 jpa annotations.
unfortunately this doesn't work out of the box with Spring Boot. Because not all annotations combinations are supported.
e.g.:
Caused by: org.hibernate.AnnotationException: #Column(s) not allowed on a #OneToOne property:
Used Database is db2. The connection works fine. Only the share entity model does not work out the box.
I'm looking now to use a spring boot application that uses openjpa with a db2 database and a persistence.xml with an external jar file. Someone got any experience with this?

Spring Batch Project with Annotation Integrated with Spring Batch Admin

I have a Spring Batch Project which uses annotation based configurations and is a working code by itself. I now want to integrate this with a new Spring Batch Admin project.
I tried some solutions available/answered in the blogs, like adding dependency of batch project to the batch admin project and modifying the META-INF/spring/batch/servlet/override/context-config.xml file to point to the batch project config file.
i.e. . The com.sample.springbatch.job package is present in the Spring Batch project.
However, I am not successful with the integration.
Can anybody point me to or suggest a solution where Spring Batch Project - Annotation Based is integrated with Spring Batch Admin project.
Thank you!
Sonali
I tried this with Batch Admin 2.0.0, you don't want to use #EnableBatchProcessing which is already provided with Spring Batch Admin rather you may use #EnableBatchAdmin. I've added the code in github

Facing Spring Roo issue while converting JPA project to non-JPA project

I have a Spring - JPA project generated using Spring Roo. Now for some requirement we are replacing our JPA layer with some other framework (MyBatis) which is not JPA-compliant. I have done the changes and they are working fine also. I have removed all the JPA dependencies from my pom.xml file.
I am facing issues with my JUnit test project which is used to test DAO layer. Spring Roo is looking for the javax.persistence.Entity class which is part of JPA specific jar.
Please find below the error details below:
can't determine annotations of missing type javax.persistence.Entity
when weaving type ****.**.***Test
when weaving classes
when weaving
when batch building BuildConfig[null] #Files=12 AopXmls=#0
[Xlint:cantFindType]
error at (no source information available
Can anyone please advise me how to remove this error without adding a JPA dependency?
You could try to make a push-in from your test .aj file to the related .java file and then remove the necessary code (imports, annotations) that makes that your Spring Roo shell shows that error.
If you are not sure about how to make a push-in, you could read Spring Roo 1.3.2.RELEASE documentation http://docs.spring.io/spring-roo/docs/1.3.2.RELEASE/reference/html/removing.html#removing-step-by-step-1
Regards,

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?