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/
Related
I have some questions about Spring Boot and Hibernate.
I discussed with one developer and he said me he compile his Rest Api, developed with Spring Boot, in Jar and used the tomcat server provided by Spring Boot and deploy the jar on the server. But in my case, i use the war packaging and i deploy on my tomcat server but he said it’s less performing.
I don’t know why and i asking me if you developed in microservices your Resp Api with Spring boot and you use his solution, do you create multiple tomcat instance ?
About hibernate, i used HQL for some queries and he said me it’s bad way because it’s dangerous with Sql injection, it’s true ?
I need some answers of people who can advice me.
Sorry if my english, it’s not great and thank you very much, in advance, for your answer.
In the Java Cloud space there are 2 major directions:
Java EE:
Create a Docker base image which includes a Java EE application/ web server such (e.g. Tomcat, WildFly, GlassFish,...)
Create a (thin) WAR file
Create a Docker image based on your base image which deploys the WAR file to the application server
Spring Boot:
Create a single JAR file using the Spring Boot Maven Plugin
Create a Docker image which executes the JAR file
I guess you could also mix the two approaches (create a Spring Boot WAR file), but the single JAR file approach is much more common with Spring Boot (I'm currently using this approach).
Some Java EE experts such as Adam Bien promote the first approach (less dependencies, smaller WAR files, smaller Docker images, more standard APIs (though what "standard" means is currently changing with the transition from Java EE to Jakarta EE)).
I can't tell you which one has a higher performance. Either way there will be one server started per Docker image.
Regarding Hibernate and SQL injection:
I'm not using HQL but JPQL, but in the end it's more or less the same as with JDBC: Don't string concatenate queries with input from the user. Always use some kind of prepared statements with variables to format the user input.
If you are using spring boot you implement more or less a standalone application (even if it´s a webapplication), therefore yes there will be an own embedded tomcat, jetty, whatever instance for each spring boot application.
SQL injection has nothing to do with the way how you deploy an application, it´s only a question how you create your HQL queries.
However, that´s an interesting discussion. In our company we are quite old fashioned and create an WAR file of our webapplication, and deploy it on our Glassfish server where serveral other web applications are running under the same instance.
Florian
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/
I am setting up a simple example to persist one Person entity using Hibenate in an OSGI Equinox using eclipse. I read the official documentation in Hibernate web site but the examples use another frameworks and I dont know how many bundles I need and how to set up them.
After a few days trying to use hibernate in an Equinox Osgi, I get it. I created a thread in the Hibernate Forum so you can go there:
https://forum.hibernate.org/viewtopic.php?f=1&t=1029974&p=2473673#p2473673
Basically you need to do step by step, setting up every bundle that you need, and also updated to the Hibernate 4.3.0 version and take care with the order of your bundles in run time!!
I'm learning hibernate and I am running into some issues. I'm reading "Harnessing Hibernate" by O'Reilly. They explain everything using ANT, but since I want to avoid writing a huge build.xml file, I'm trying to get it to work with IntelliJ.
I managed to make a mapping according to a DB table in a MySQL database, and wrote the bean for it. It worked, but I can't find any information on how to generate beans and SQL code, or how to reverse engineer with IntelliJ. I found loads of tutorials about Eclipse, using JBOSS Hibernate tools plugin, and the site claims this support for generating code is already in the standard installation of IntelliJ.
Am I forgetting some configuration such as adding libraries? I'm trying to find this out but I'm desperate now. Please don't suggest me to use Eclipse, I need IntelliJ for my current role.
AFAIK, IntelliJ IDEA includes the complete JPA/Hibernate support in its Ultimate Edition:
Generating Persistence Mappings from Database Schema
IntelliJ IDEA allows you to quickly
generate persistence mappings from any
database schema: Generating
Persistance Mappings
(source: jetbrains.com)
Now, the question is, what edition of Intellij IDEA are you using?
If you add the hbm2ddl to your Hibernate config and ask it to create the database schema you'll get it by running a single test or some other code that exercises Hibernate. Once you have it, turn off create.
Let Hibernate do the work.
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.