Enable weaving in an Eclipse RCP application - eclipse

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

Related

can equinox be used outside of eclipse?

I'm looking to understand osgi and find it confusing that every tutorial requires eclipse or is developed using eclipse (which complicates my understanding)
Is it possible to work with equinox without eclipse and is there an example of how this can be done?
You can create OSGi applications without eclipse. What you see in many tutorials is using the Eclipse Plugin Development Environment(PDE) for OSGi development. This is one way but not the only.
In many Apache projects like Apache Karaf you can see a very different maven based OSGi development. In this case you create normal maven projects and simply add a plugin to enhance the jar with the OSGi metadata. For simple bundles this is all you need.
As an example see the karaf examples and tutorials. In the case of karaf as a OSGi server you have the choice between equinox and felix for the OSGi framework.
A third approach is using bndtools. This again is a eclipse plugin and maven plugins but a completely different development workflow than PDE. The new examples for bndtools are also maven based like in Apache Karaf but they use a different assembly. As an example see this. It can be built with just maven but using the bndtools eclipse plugin makes it easier.
While Karaf uses features as primary assembly unit bndtools uses a OSGi repository + requirments.
So you have the choice of three different styles. Each with different pros and cons.
Especially the karaf style is also very applicable for intellij.
OSGi is a standard. Equinox is an implementation of this standard. As it is mentioned on Equinox homepage, equinox is even the reference implementation (http://www.eclipse.org/equinox/) :
The Equinox OSGi core framework implementation is used as the reference implementation and as such it implements all the required features of the latest OSGi core framework specification
As a consequence, yes it is possible to use other OSGi implementations : Apache Felix, ... (see https://en.wikipedia.org/wiki/OSGi_Specification_Implementations ). If you choose Felix, you will no longer use Equinox. But both implements the OSGi specification : https://osgi.org/javadoc/osgi.core/7.0.0/
In addition, you must distinguish the OSGi implementation from the development environment you choose (IDE). Eclipse is an ambiguous term that fits both. Even if you choose Felix implementation, you can code in eclipse.
I think that if most of the samples you find are based on eclipse Equinox and developed in Eclipse, it the result of the fact that :
- Equinox is the reference implementation of OSGi
- Eclipse IDE includes many tools to develop OSGi application through the PDE (Plugin Development Environment : https://www.eclipse.org/pde/ )
In conclusion, I would say that Eclipse probably cumulate the best IDE & implementation to work with OSGi. As far as I can see, it's a good thing for you to follow eclipse based tutorials, just remember that equinox is an OSGi implementation that you could replace by another like Felix.

Spring IDE Bean Graphs is blank for blueprint configuration file

I have installed Spring IDE 3.7.2 (Core + OSGi Extension), in Eclipse Mars SR1 Java EE.
I am writing blueprint bundles, and the tooling seams to work except for Beans Graph, who remains empty (with no errors in error log),
With a similar configuration for spring, the beans graph is displayed
After investigating this, it seems there is no org.springframework.beans.factory.xml.NamespaceHandler implementation provided for http://www.osgi.org/xmlns/blueprint/v1.0.0 namespace.
I manage to write a "quick and dirty" implementation based on one I found in eclipse gemini blueprint as a proof of concept
Is it something you could be interested in as a contribution ?

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

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.

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.