We have a problem with migrating our j2ee ear application from weblogic 12.1.1 to weblogic 12.2.1. We use hibernate 5.2.10.Final as a jpa provider and package it into the ear.
Hibernate has an implicit dependency of antlr 2.7.7, so the ear contains this jar too. But weblogic has internally on its classpath an antlr 3.2
We made its classloader prefer the contents of our ear, which is antlr 2.7.7, but this way weblogic throws an exception at some JMS method calls, where we use a JMS expression filtering for correlation id. So this way we lose an application server feature we use.
If we use antlr 3.2 instead, would it be a problem for hibernate? Or what other options we have to use both functionality (hibernate and weblogic)? In eclipselink I checked, that it is solved by the way of repackaging antlr to some org.eclipselink... Is there a hibernate version available like this?
Ok this is old, but I had a similar problem. In our case it was the scope "provided" that made the problem.
Seems in Hibernate 6.0 they will upgrade the antlr4.
http://hibernate.org/orm/releases/6.0/
Related
I have a Maven enterprise project that is composed of ear, web and ejb modules. The EJB module uses JPA persistence with Hibernate 5.0.3 as a provider. I have a bunch of JPQL queries that use “SELECT NEW com.package.path.CustomerReport(anotherEntityObject, COUNT(anotherEntityObject.repList))....” type of syntax. When I test these queries outside the Glassfish, they work just fine. However, when I deploy the project as part of the ear to a Glassfish 4.1 app server, the deployment process fails. Hibernate complains that it cannot not find a matching constructor (“ERROR: Unable to locate appropriate constructor on class... Expected arguments are:...”). The constructor is there; and the order of arguments is correct. After all it works with no issues outside the app server.
One of the threads below suggest to put #SuppressWarning(“unchecked”) when working with these types of queries (SELECT NEW...). This has been already placed in the code by prior developer. When using EclipseLink I do not have this issue. I would think that this would work with Hibernate as I am using standard JPA. Somebody must have had a similar problem. What could be a cause of this error? Could there be an issue in the way the project gets built by Maven(maybe #SuppressWarning is not included)? I would appreciate if anyone could provide a suggestion or a fix for the problem.
Thank you very much.
Things I have considered/looked at:
JPQL/Hibernate limitation using constructor expression in SELECT
JPA JPQL: SELECT NEW with COUNT, GROUP BY and ORDER BY
hibernate: Unable to locate appropriate constructor on class - HQL
I know the difference between JPA and specific implementation for example Hibernate or EclipseLink, but what I am interested in, when I download for example Eclipse JAVA EE version, and then in my project use javax.persistence package, which implementation does it use? My guess would be EclipseLink or OpenJPA but how do I know?
I am interested in this because I compared performance of Hibernate and javax.persistence package (just few thousand of rows from db) and the performance gap from my point of view was quite big (about a second)
You can choose it in the JPA Facet pane by using the Platform dropdown. See Eclipse documentation.
If you want to use Hibernate, you have to add it manually in the Eclipse Marketplace. See: JPA Creation - Hibernate not showing in platform
Eclipse EE will bundle EclipseLink via the JPA facet you can add to a project, but other than that it doesn't really provide any specific implementation (you can configure it to provide other implementations if you configure with facet with other user libraries). Your implementation is provided either by libraries, or your app server that you are deploying to. For longer term, a more strategic approach would be to explicitly include an implementation either through dependencies (maven) or referring to/using libraries provided by your app server.
I have searched everywhere for a list of jars necessary and they don't seem to be available all in one bundle as they are in 4.x. This is my first go at setting it up.
Also, does it matter which version of hibernate validator I use if I'm using Hibernate 3.5?
I would like to use 4.x, but I cannot solve this problem:
Unexpected UnsupportedOperationException on Hibernate validation failure
If you are not using maven for building, you should download the Hibernate bundle from SourceForge. It contains all the dependencies you need.
Also, I have been using Hibernate Validator 4.3.0.Final with Hibernate 3.5.6 final so I think there should be no problem.
You can download the Hibernate Validator bundle at SourceForge too.
I am trying to configure hibernate 3.6.7 with glassfish 3.1.1.
If I just install the module from update-tool in glassfish I get hibernate 3.5...
I want to use hibernate search 3.4.1 Final.
I want to build a website and I will have lots of items into database and I want it work ok (use lucene search integrated in hibernate). - I want to use lucene spellchecker later
Do you suggest me to switch to jboss AS 7? I am willing to create a java ee application (ejb, standalone web tier) if so... do I have to create more xml's, configuration stuff for jboss as 7? or just add my datasource and I'm done...???
Or should I make my lucene code and use it with eclipselink?
What do you think it's best?
Regards
I use Eclipse and glassfish 3.1 with Hibernate 3.6.7. and hibernate search. Everything works fine. You don't need tons of xml, I use JPA so I have persistence.xml. I set my database access in glassfish, put the jta datasource into the persistence.xml and some hibernate search related config, that's all.
I tried jboss too, but I think glassfish is easier to use. I don't know what's the best, pick one and try it :)
With the help of #hcpeter I managed to configure...
Here is how is done:
Copy all jar files (only jar files, no folders.. take the jars out of the folders) in glassfish3/glassfish/lib/
In eclipse, the "default implementation library" what jars files do I need to include if I do not want to use server runtime?
I'm refering to this tutorial http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jpt.doc.user/task_create_new_project.htm
Follow Using TopLink JPA with Dali to get started with the Toplink Essentials (JPA reference implementation). To get the mentioned jars (toplink-essentials.jar and toplink-essentials-agent.jar), download them from there or, if you use Maven, from the Java.Net Maven Repository.
PS: Please note that after 2.0-b36, the toplink-essentials-agent.jar file is no longer needed as the agent facility is now integrated into toplink-essentials.jar. So you can do like below.
$ java -javaagent:toplink-essentials.jar client.Client
Depends on what implementation you want to use. There are currently three most popular implementations: Hibernate, TopLink and EclipseLink.
I know about hibernate that it's README file explains what jars are mandatory for what functions. If you use JPA you must have some sort of EntityManager (hibernate can be used without EntityManager too), so you need all the dependencies of it.
To download hibernate JPA implementation use this link (look for hibernate-entitymanager). You need hibernate core, annotations and entity manager for JPA. If you use all the jars in those three packages you should be ok. But I strongly suggest you to read the README files.