Hibernate Search upgrade for JDK-17 and Jakarta Persistence APIs - hibernate-search

We are experimenting with JDK-17 migration. One of the steps was to migrate from javax.persistence to jakarta.persistence libraries.
Looks like Hibernate search is yet to upgrade to Jakarta Persistence. Could you please share if this is planned in future releases. or any alternatives.
Please be informed that we have tried with both 6.1.8.Final & 6.2.0.Alpha1 versions.
Thanks in advance

Hibernate Search 6.1+ does work with Jakarta Persistence and/or Hibernate ORM 6, but you have to switch to different Maven artifacts:
Artifacts suffixed with -orm6 for Hibernate ORM 6: https://docs.jboss.org/hibernate/search/6.1/reference/en-US/html_single/#other-integrations-orm6
Artifacts suffixed with -jakarta for Hibernate ORM 5's -jakarta artifacts: https://docs.jboss.org/hibernate/search/6.1/reference/en-US/html_single/#other-integrations-jakarta
See also https://hibernate.org/search/releases/#compatibility-matrix

Related

JPA Eclipse link from Open JPA - IBM WAS 8.5.12 server

I would like to migrate to Eclipse link and JPA 2.1 on IBM WAS server and DB2. Could you please advice the sets need to be followed? If anyone used before, please explain to us what are the things to have cared?
I am going through the document - https://developer.ibm.com/wasdev/docs/can-i-use-jpa-2-1-on-websphere-application-server/
If you want JPA 2.1 I'd strongly suggest to migrate to WebSphere Liberty (preferably) , as it fully supports that and you already have license for that if you have WAS 8.5, or migrate to tWAS 9.0. On WAS 8.5.x you will have to disable JPA scanning, use application-managed persistence, create shared liberary.... not really worth.
In addition to server settings changes you will have to migrate your app from OpenJPA to EclipseLink. There is free Eclipse plugin - WebSphere_Application_Server_Migration_Toolkit that you can configure to scan your application sources for OpenJPA -> EclipseLink migration.
But also for WAS 8.5.x -> WebSphere Liberty migration ;-)

Upgrading GlassFish 3.1.2.2 to use JPA 2.1

I am working with GlassFish 3.1.2.2 (I can not upgrade to 4 due to OS restrictions).
I'm interested in upgrading JPA 2.0 to JPA 2.1 GlassFish 3.1.2.2. How can I achieve this?
This is most likely not possible at all. JPA 2.1 is part of EE 7 and therefore not fully integrated with EE 6 GF 3.1.2.2.
Did you try just replacing the EclipseLink and JPA jar files in Glassfish?
It will probably work, but if you use managed persistence units they will not expose any JPA 2.1 API, you would need to unwrap the EntiyManager to access these.
I'm using Hibernate 4.3.8 (requires JPA 2.1) with Glassfish 3.1.2.2.
Note: I'm not using any services provided by glassfish. All the libraries I use are in the WEB-INF/lib.
1 - Override all JPA classes (package javax.persistence) in glassfish/modules/javax.persistence.jar with JPA 2.1 version. You should not replace the entire JAR, only override the classes. This JAR has an OSGI manifest and other classes that must remain there.
2 - Remove all javassist classes (package javasssist) from glassfish/modules/weld-osgi-bundle.jar. This solves a possible incompatibility if you are using Hibernate.

MyBatis integration with JBoss 7.1 web application

Had anybody attempted to use MyBatis as their persistence library for a JBoss 7.1 /Java EE6 application?
I'm wondering what are the best approaches to handling connections, transations, rollbacks etc?
How about CDI support? Looking around online it seems at this time MyBatis only supports two Dependency Injection (JSR-330) frameworks, Google Guice and Spring. I did run into CDI Extensions which may be something look into.
My idea would be to have the container handle all of the above however it may be difficult getting to that point.
Any tips, hints, experiences?
There is a new mybatis-cdi module. It is not released yet, but you can try the snapshot, it is at github: https://github.com/mybatis/cdi
There is no CDI support at all but as you said, if you want DI go Spring or Guice.
With JBoss you have mainly two chances:
- EJB 3
- Spring
If using EJB 3 transactions are handled automatically by them. MyBatis just ignores transactions and lets the container commit/rollback.
When using Spring, MyBatis ties to Spring transactions using the integration module MyBatis-Spring.
I would create my own CDI bean - use #Produces for a factory, and #Inject to get the session.
Here is old iBatis Spring factory, that might be the producer, after some changes:
SqlMapClientFactoryBean

Migrate from EJB 2 Entity Bean to EJB3

I am having some entity beans created in EJB 2.0 and now I need to migrate to EJB 3.x, but I've studied that use of entity beans are changed in EJB 3.x and they are using JPA instead.
Where can I find solution to actuate my beans to be comfortable with EJB 3.x?
For example from following resources available online:
http://www.datadisk.co.uk/html_docs/ejb/ejb3_migration.htm
http://www.oracle.com/technetwork/middleware/ias/oc4j-twp-ejb3-migration-1013-133021.pdf
or following printed books:
Pro JPA 2 Mastering the Java Persistence API (p. 457-466)
EJB3 in Action (p. 513-528)
IntelliJ EJB refactoring tools might prove to be useful: http://www.jetbrains.com/idea/webhelp/migrating-to-ejb-3-0.html
I belive there are some for Eclipse too.
just for future reference, I recommend the following link:
http://what-when-how.com/enterprise-javabeans-3/migrating-cmp-2-entity-beans-to-the-ejb-3-jpa-part-1/
And there's also part 2 on the same site as well as migrating session beans and MDBs.
I used them and found them very helpful and useful.

How to install JPA persistence provider in spring roo project?

I am looking SpringSource Tool Suite with Google Integration and I am getting that hint when I define persistence setup.
hint:"Command 'persistence setup --provider DATANUCLEUS --database HYPERSONIC_IN_MEMORY' was found but is not currently available (type 'help' then ENTER to learn about this command)"...
and help is saying that: * persistence setup - Install or updates a JPA persistence provider in your project
how can I install JPA persistance provider to my project?
Have you tried with another provider? i.e for Hibernate it would be something like:
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
I believe you can choose between ECLIPSELINK, HIBERNATE and OPENJPA.
I had a similar problem and I solved it creating the project using Roo instead of the Eclipse ide.
You can do it typing this in the Roo console in Eclipse:
project --topLevelPackage com.company.projectName
Depending on the version of Roo, the keywords have changed. In Spring-Roo version 1.2 and above:
roo> jpa setup --provider ECLIPSELINK --database H2_IN_MEMORY
Earlier versions of the persistence framework configuration use a persistence setup command, which has changed to the newer jpa setup in light of support for configuring non-SQL databases.