After many problems with "CLASS NOT FOUND" problems in OSGi working with JPA persistence & Eclipse link, I found some article introducing PAX JDBC driver adapter.
Does anybody has some experience with this ?
Pax JDBC should be fairly straightforward to use. Just check out the docs.
In combination with Eclipselink, you should probably stay clear of the Eclipselink OSGi adapter which has an unnecessary dependency on Eclipse Gemini DBAccess, at least last time I looked at it.
Pax JPA is an incubating project which provides OSGi Enterprise compliant adapters for Eclipselink and OpenJPA.
Related
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.
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
Had anybody attempted to use MyBatis as their persistence library for a JBoss 7.1 /Java EE6 application?
I'm wondering what are the best approaches to handling connections, transations, rollbacks etc?
How about CDI support? Looking around online it seems at this time MyBatis only supports two Dependency Injection (JSR-330) frameworks, Google Guice and Spring. I did run into CDI Extensions which may be something look into.
My idea would be to have the container handle all of the above however it may be difficult getting to that point.
Any tips, hints, experiences?
There is a new mybatis-cdi module. It is not released yet, but you can try the snapshot, it is at github: https://github.com/mybatis/cdi
There is no CDI support at all but as you said, if you want DI go Spring or Guice.
With JBoss you have mainly two chances:
- EJB 3
- Spring
If using EJB 3 transactions are handled automatically by them. MyBatis just ignores transactions and lets the container commit/rollback.
When using Spring, MyBatis ties to Spring transactions using the integration module MyBatis-Spring.
I would create my own CDI bean - use #Produces for a factory, and #Inject to get the session.
Here is old iBatis Spring factory, that might be the producer, after some changes:
SqlMapClientFactoryBean
I am having some entity beans created in EJB 2.0 and now I need to migrate to EJB 3.x, but I've studied that use of entity beans are changed in EJB 3.x and they are using JPA instead.
Where can I find solution to actuate my beans to be comfortable with EJB 3.x?
For example from following resources available online:
http://www.datadisk.co.uk/html_docs/ejb/ejb3_migration.htm
http://www.oracle.com/technetwork/middleware/ias/oc4j-twp-ejb3-migration-1013-133021.pdf
or following printed books:
Pro JPA 2 Mastering the Java Persistence API (p. 457-466)
EJB3 in Action (p. 513-528)
IntelliJ EJB refactoring tools might prove to be useful: http://www.jetbrains.com/idea/webhelp/migrating-to-ejb-3-0.html
I belive there are some for Eclipse too.
just for future reference, I recommend the following link:
http://what-when-how.com/enterprise-javabeans-3/migrating-cmp-2-entity-beans-to-the-ejb-3-jpa-part-1/
And there's also part 2 on the same site as well as migrating session beans and MDBs.
I used them and found them very helpful and useful.
I'm looking for a tutorial where the following technologies: flex blazeds spring jpa hibernate are use into eclipse to create a Java EE web dynamic project.
I wish that the jpa and hibernate will be auto-generated by an orm plugin (such as hibernate tools, or other one).
the dao and dto will be both implemented in this architecture.
and why not using the springsource tools suite under eclipse.
I'm working with the eclipse galileo SR2, mysql as database and tomcat, but for the two last technolgies other ones are welcome.
I agree, this is a very general question. Try this tutorial though, it will help you with Flex and Spring integration.