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

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.

Related

Spring Tools Suite, JPA project and the JPA facet

I am using a fresh install of STS 3.8.3 and I am unable to add the JPA facet to an EJB project:
If I try to create a JPA project, I cannot find that option:
I am certain these used to be available in STS. What did I miss?
We removed those extensions from the default distribution because users reported severe issues (search for JPA Event Handler on SO). In order to avoid this we decided to remove those tools from the distribution and added them to the extension install, so that you can get them back into STS quite easily.
However, we can revisit that decision in the future, if those tools don't cause those issues anymore.
Upon further investigation I discovered that the Eclipse Web Tools Platform at eclipse update site http://download.eclipse.org/webtools/repository/neon includes the following:
Why is this no longer configured in STS? That is really too bad and not a good decision in my opinion.
Go to Help -> Install New Software -> in the work with drop down , choose one with "https://download.eclipse.org/releases/*".
In the result you will be able to see Database Development.
Choose the database you wish to configure.

Eclipse: Can not find the tag library descriptor for "http://java.sun.com/jsf/core" using JBoss

I know this question was asked a lot of times, since I searched for hours for a solution, but it was never answered (or at least not for my situation).
I am using Wildfly 8.0 (ex JBoss), so I understand that I do not need to add jstl jars nor JSF jars since the implementation is already shipped with JBoss.
Now even when telling eclipse to use the Wildfly runtime libraries, I get the above error. I checked and the jboss-jstl-api_1.2_spec-1.0.4.Final.jar is part of the library
How can I get through this? I tried putting downloading jstl jars (from https://jstl.java.net/) and putting them in the lib directory but it is not working.
Copying the jars into "lib" works perfectly when I use Tomcat which doesn't have its jstl implementation. But not with Wildfly (maybe because eclipse ignores the jars I put in the lib directory since Wildfly has its own jars? But then why do I get the error in the first place? I am confused).
Thanks to anyone who could help me with this.
Edit: I forgot to precise that even with these errors on all my JSPs, the project builds and works perfectly on the server.
These errors are eclipse specific, it does not recognize the taglibs and displays annoying error messages at taglib declarations and warnings when using these (unknown to eclipse) tags. Plus, I can't use code completion.
Edit: I bypassed the problem, for the moment, by adding standalone myfaces and jstl libraries to the build path. I would like though that eclipse uses the jars available on server side. (For JPA for example I did not need to add the hibernate library to the build path, I simply told eclipse that the JPA implementation si available on server runtime and it worked fine with code completion and everything).
Alright, to not have to add any additional libraries (that are not needed by the server) here's what I had to do in addition to adding the Wildfly runtime library to the project:
Go to Project/Properties/Project Facets/Java Server Faces and chose Library Provided by Target Runtime in the library type (instead of a User Library).
I'm truly disappointed JSF support in eclipse. I'm encountering such caveats all the time.
I'm using JBoss 7.1.1 and even adding JBoss as the Target Runtime of the project didn't help.
The only solution that worked for me, was to define new JSF library inside Eclipse: Window Preferences -> Java -> Build Path -> User Libraries -> click New (pointing to the jsf-impl.jar and jsf-api.jar). And then adding such library to the build path of the project.
It solved all annoying eclipse errors can not find tag library. So it is pretty similar to the #Riccatti first solution.
Btw: answer which I found on the eclipse forum says that this error is usually caused by not existing JSF tag libraries (that are present in jsf-impl.jar) on the classpath.

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

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

Start a Maven J2Me project in Eclipse and run it

I have a problem setting up my maven j2me project that I created in Eclipse.
I have the WTK 2.5.2 & SDK 3.0 installed and associated with Eclipse.
I created a project using j2me-simple archetype.
Copied the files from my previous J2Me project which was working!
but as I see, all the files that I know are missing. the Application descriptor, the J2Me packages lib that was there (Eclipse used to add these automatically) and lots of other stuff, what didn't I do?
Adam.
I created a project using j2me-simple archetype (...)
I'm not a J2ME expert but what you get when using the j2me-simple archetype is a maven project using the j2me-maven-plugin with default preconfigured settings that you can tweak in various ways (there are lots of commented part in the generated pom.xml).
but as I see, all the files that I know are missing. the Application descriptor, the J2Me packages lib that was there (Eclipse used to add these automatically) and lots of other stuff, what didn't I do?
I'm not sure but according to the documentation of the j2me-maven-plugin site and the content of the generated pom.xml:
the application descriptor: seems to be generated
the J2Me packages lib that was there: most dependencies are commented
In my opinion, the generated project is not that complex if you are used to Maven and the various J2ME concepts involved in the configuration. If you are not, it might not be that easy to use though as it seems to offer several configuration options and will thus require some configuration to match your needs (and flexibility generally induces some complexity in the configuration).

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.