How to use JodaTime type converter for Eclipselink - jpa

Actually I want to use Joda-Time to store dates in my database (Postgresql) like it's described in this thread or this one. I use JSF running on Glassfish (3.1.2.2). My problem is, I don't know how to use the converter for EclipseLink. EclipseLink is already shipped and bundled in Glassfish.
How can I access eclipseLink from my IDE (Netbeans)?
Any other suggestions? thanks.

Related

MySQL to ObjectDB Migration

A maven JEE project using JSF, JPA (EclipseLink 2.3) is using MySQL comminity edition as the database. With the size of the database exceeding 20GB, there are database related peformance issues. As a solution, I am going to use ObjectDB.
I am doing to use two persistence units for each database and migrate objects. Will it work? If not, is there any other recommendation? I tired the web to search, but could not find any totorial explaining how to do it ?

How to use OpenJpa using persistence.xml without using Enhance.xml ..?

How can I use OpenJpa ,with using Persistence.xml configuration same we use in jpa, I dont want to use Enhance.xml.
If you rely on some non-IDE tool to build your app, you can enhance automatically during buildtime. For Maven, for example, see this
If you are running in a JavaEE container you will get enhancement for free. The other option when running in a JSE environment is to configure the -javaagent.
Take a look at the section titled 'Explicit javaagent support'. As for JavaEE stuff, I'd suggest getting ahold of the Pro JPA 2 book. It is very good at describing usage of JPA in an EE environment.

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

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.

Java EE How do you use an EntityManager with Mongo?

I"m trying to create a Java EE project using a mongo database. I am unable to find any good working examples.How do you correctly set up JPA for the project?
Java EE 6 (or in JPA 2.0 as an part of it) does not have any defined support for MongoDB or for NoSQL databases in general.
That's why how it is done depends fully from JPA provider implementation. If you use EclipseLink, maybe you can try to follow example given in this blog post and present further questions about what exactly is not working.
Hey you should at least check out Arun Gupta's blog post on this at https://blogs.oracle.com/arungupta/entry/java_ee_6_and_nosql. Gupta is the Oracle Java EE Evangelist and this entry covers using EclipseLink for a JPA connection to MongoDB and deploying to Glassfish. If you search his blog, there is also an earlier entry on how to use the Java driver included with MongoDB in a Java EE project. I haven't tried the example with an EntityManager but am thinking about doing so.