How do I add Hibernate to an existing Eclipse project? Is Hibernate the same as JPA? - eclipse

I have searched. I can't find the exact way that matches what I have. I installed Eclipse for Java EE. I then went to help and install new software. Put in the jboss url, downloaded the Hibernate libraries. Everything went fine. I also installed the JDBC driver for MySQL. I tested it. It works. Downloaded and installed slf4j because I read someone that said to (hey, I'm learning).
I started a new Java EE project, and uh, I'm kind of stuck after that. It's a "Hello World" at the moment.
I can't find out what to do. I've seen tutorials where it says create a Hibernate project, but what if I want to add it later after I start a "normal" project? I don't want to manually look for the Hibernate.jar in the download folder. I installed it and want to know how to get to it.
I also saw lots of things that said JPA and Hibernate. Are they the same thing?
EDIT: I was able to find Hibernate by right clicking on the project, new, scroll down to hibernate. I am still interested in JPA and Hibernate.

JPA stands for "Java Persistence API", and it is a specification. It basically defines the APIs and behaviors of a persistence layer, and there are different implementations of the JPA specification. Hibernate is one of these implementations. There are a few others, e.g.:
http://www.oracle.com/technetwork/middleware/toplink/overview/index.html
http://openjpa.apache.org/
The JPA specification can be found here:
http://jcp.org/aboutJava/communityprocess/final/jsr317/index.html

Related

Enable weaving in an Eclipse RCP application

I use EclipseLink 2.4.1 in an RCP application. When starting the application I get warning messages like
Reverting the lazy setting on the OneToOne or ManyToOne attribute [...] for the entity class [class ...] since weaving was not enabled or did not occur.
The reason is explained here and here. The answers point to the eclipse link documentation and the eclipse link user guide. The solution to enable dynamic weaving is
... the EclipseLink agent must be used when starting the Java VM.
java -javaagent:eclipselink.jar
My question is
Do I have to include the bare jar eclipselink.jar in my distribution (where?) or is it sufficient to add a dependency to some special eclipse link plugin, e.g. to org.eclipse.equinox.weaving.hook?
After further research I see that Gemini/JPA may be a solution. However, I'm still puzzled how to get all pieces together.
Yes, Gemini JPA is the way forward as it provides Enterprise OSGi JPA support with EclipseLink. It also supports weaving using standard OSGi byte code weaving.
You can get Gemini JPA help on the forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id=153
--Shaun

weblogic data source not listed in eclipse

I was developing java ee applications in netbeans, for some reason I jumped to eclipse.
In netbeans when I click on "entity classes from database" I used to see oracle's data source, basically the database. And easily I used to create my beans.
Now, is there any way to do so in eclipse? If so, how to do that?
There is no direct equivalent for the netbeans functionality you are seeking in eclipse (or at least not that I know of in the stock eclipse install).
For starters, you should be using the eclipse version built for Java EE developers. It has a Data source explorer as one of the tabs. Here, you can add data sources that you can use to configure your applications.
More information here.

How to specify Library Provided at Runtime for Hibernate - Eclipse Dali JPA integration

I am trying to add Eclipse Dali JPA integration and to specify Hibernate as the JPA implementation. I have gathered different instructions but am struggling with specifying the user library when configuring the project facet. The page here (http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/4.0/html/Hibernate_Tools_Reference_Guide/dali_integration.html) shows an option that says Library Provided by Target Runtime but I don't have this option. I have User Library and Disable Library Configuration. I'd rather not download the hibernate jars and store them separately for eclipse configuration when I already have them specified in the project with maven. And the disable option leaves the configuration in error.
Anyone have any tips for getting that option or another suggested Hibernate/JPA configuration within Eclipse?
Thanks all.
If you are already doing library management with Maven and m2e, you should select Disable Library Configuration option. Yours is exactly the scenario that option was intended for. If you specify the errors you get when you follow this approach, someone may be able to help find the complete solution.
Alternatively, follow the User Library option and create a user library using the Hibernate jars you already have locally. There is no need to re-download them.

reference for ejb jboss and eclipse development

is there a reference or book, maybe a tutorial that can get me started with ejb using the technologies that I have mentioned above?
thank you
You can take a look at the JBoss Tools if you're interested in developing Java EE applications in Eclipse.
If you already know EJB (and if you don't there is quite good Enterprise JavaBeans 3.1 book) you know you can develop your EJB's as plain POJO's just with annotations. No need for fancy plugins here.
You would, however, need a plugin to easily deploy your application to the server. In this case, take a look at these JBoss Tools and this topic.

Eclipse plugins for Spring / Hibernate development?

I have a running dynamic web project in Eclipse (Java EE + Maven + Spring). I am at the point where I need to integrate a persistence layer and want to use Hibernate with a MySql database.
I am wondering what plugins would be useful for me at this point? For Hibernate should I install hibernate tools or is it not necessary? Are then any plugins that are most widely use for connecting / exploring database connections that would be appropriate for the type of project I am working on? Thanks.
Hibernate Tools is definitely a nice plugin (that provides wizards, a nice console useful to setup the HQL queries, a mapping editor, etc). I'm actually tempted to say: why not using it? I use it in conjunction with the database support provided by the Eclipse Data Tools Platform (that is included in the Eclipse IDE for Java EE Developers or available via the update manager). In your case, I would maybe just consider using SpringSource Tools Suite as base instead of a vanilla Eclipse.
Update: As reminded by BalusC in a comment, the Hibernate Tools also include a database reverse engineering tool which is maybe the most powerful feature. I should have mentioned it, this is now fixed.
You can look at http://fast-code.sourceforge.net/ as well. You can create FooService and FooServiceImpl and the configurations just by typing foo. It has nice way to create unit tests as well.