Is it possible to use EclipseLink with QUarkus? Or is Quarkus too hardly coupled with Hibernate?
We are in the process of choosing our MP implementation and we want to stick as close to the reference impls as possible
I am not seeing much information on https://quarkus.io/guides/ or even this very forum to indicate that eclipselink too can be used with Quarkus.
Any pointers on why Quarkus is tied so tightly to a specific impl (if it is) of JPA would also be welcome
TIA
Rahul
You can use EclipseLink by adding it in your classpath as fxrobin mentioned. But it won't work for native image generation, nor will be integrated with the database connection pool, the transaction enlistment etc. Finally the startup time will be much longer.
The reason Quarkus focuses on Hibernate ORM is exactly for these reasons. Making Hibernate ORM work on native, making it do work at build time to speed startup time, smoothly integrating it with other areas takes a lot of time. Someone could make the same for EclipseLink with a few months of work ahead of them.
You can add EclipseLink in a class way as if you were in Java SE. But then you have to manage the transactional behaviour by code but not with annotations.
Related
I currently use Jpa via Hibernate in my application. Since spring security oauth2 provides JdbcTokenStore, I started using it. But the problem with that is, I cannot use cache (which all my entities in the application currently share).
It hits the database in a separate flow.
I am thinking implementing JpaTokenStore thats backed by Jpa & leverage the cache advantages that comes with it.
Did anyone try implementing this/see any downsides using this approach?
In one project I've implmented org.springframework.security.oauth2.client.token.ClientTokenServices with JPA and didn't notice any problems. I was able to use all standard features of JPA including #Transactional for JPAClientTokenServices#saveAccessToken
There is nothing stopping you from doing it, and plenty of people do use JPA for all sorts of things, but IMO JPA is not ideal for handling storage of identity data. JPA is designed and optimized for cacheing data for the duration of a JDBC connection (a transaction basically), while identity data have a typically different and much longer lifetime. If you store long lived data using JPA, you have to deal with the consequences of what happens when you access it outside its normal lifetime, e.g. use DTOs, which ends up negating the benefits of using it in the first place to some extent.
I would like to add some persistence to save some application data and I feel like I have searched the web for days without any success.
I have found some older links and the eclipse Gemini project. However, I suppose I am too new to understand the implementation or it is just a little dated. Probably, more of my lack of knowledge.
Anyway, is anyone willing to point me to a working example and/or provide me with some assistance offline?
If you want to use H2 with plain JDBC, you won't need the Gemini project. In this case you can wrap the H2.jar with the corresponding JDBC driver in a single bundle (plugin) and implement your db access there.
The Gemini project is for using persistence via JPA, which works with any JDBC capable database.
In either case, be aware that in an OSGi environment like Eclipse RCP, there is one classloader per bundle. This leads to lots of complications. We are using Hibernate as JPA engine within our E4 application and we cannot split the JPA configuration, the JPA engine and the entity beans :-(
We tried using EclipseLink as JPA engine but this doesn't work on all our entities :-(
I found this blog article by Raja Kannappan which briefly explains class loading in OSGi.
You can read more about JPA in The Java EE Tutorials (although JPA is part of Java SE, too).
Hope this helps.
I was looking for the option to profile my APIs. I found Spring AOP is one of the options to profile the methods.
There are two options in Spring AOP to configure and use the aspects:
context:load-time-weaver
aop:aspectj-autoproxy
As per my understanding first option (load-time-weaver) performs weaving at load time without creating any proxy objects. And second option (aspectj-autoproxy) creates proxy objects. Am I correct on this? I believe, creation of proxy objects may hit the performance. wouldn't it?
Which option is best to choose considering better performance? What are the pros and cons of both approaches?
Well, Narendra, first of all there are profilers for profiling software. Maybe there is no need to code anything on your own.
As for your question: I have not idea how to configure Spring because I never use it. I am an AspectJ user. What I do know though, is that Spring AOP always uses proxies (JDK or CGLIB, depending on whether you need to proxy interfaces or classes). This is, as you said, something you probably do not want for profiling. AspectJ, no matter if you use compile or load time weaving, does not need or use proxies and thus should be faster. If you are not already using Spring in your project anyway, I would not touch it just to satisfy your profiling needs. Furthermore, Spring AOP only works for Spring Beans and just offers method interception, not much more. AspectJ is a full-blown AOP implementation and much more powerful. If you are already using Spring, you have a choice of using Spring AOP, AspectJ within Spring or a mixture of both.
I'm trying to write a Java EE 6 application using JPA but without using Hibernate or Spring. I used Netbeans to generate the JPA classes, and I created the tables in Postgres, but I am not able to run DbUnit tests in those JPA classes.
I have tried to base my test unit on the example described in this site: http://www.roseindia.net/testingtools/DbUnit/gettingstarted.shtml but it does not work. I keep getting a "java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory" even though I added slf4j to the project libraries in the IDE.
One thing that I find rather odd about the roseindia site example is that it does not seem to have a caller object for the test object created. I am not sure if a caller object is even needed (complete n00b in JavaEE programming, and kind of lost still).
If you choose to use entities (java classes annotated with #Entity, representing database records), you have to use some JPA provider. You are not restricted to Hibernate, though.
If you're frightened by JPA, your other option is to use plain JDBC. It is far easier to understand, if it's your learning-exercise application, it might be a good idea to try and see how it works. JPA is built on top of JDBC, so when you think you're ready for it, you'll have a solid knowledge base.
As a Java developer new to the web development environment, I was quite excited to find Grail which provides a great framework especially the convenience of abstracting DB operations with ORM. I later learned that it is actually the function of hibernate. At the same time I am delighted to learn about GWT. It is a god send for the project. I can continue building applications with event driven widgets using Java. Yeah!!
The answer seems clear: GWT + Hibernate. Will it work? What do I miss? Why there is much talk about this set up? What is the concern or area of risk? Have anyone tried this before?
Or, how do GWT developers handle the challenge of data persistence? What are the options?
Also I can't seem to find a good tutorial about setting up Hibernate with Eclipse -- the IDE I am familiar with. What are the tools or plug-ins needed?
Hibernate works fine with GWT as long as you keep in mind that the GWT code is actually running on the browser so you can't manipulate Hibernate objects in your client code. The downside to that is you're probably going to have duplicate objects on the client and server side, but you can use course-grained DTOs via the GWT remote procedure calls. On the server side, just create a ServletListener to initialize your Hibernate project and then use normal Hiberate methods to store and retrieve objects.
As far as Hibernate and Eclipse, Hibernate has an Eclipse plugin, but it's not really necessary to develop in Eclipse. It gives you the ability to run HQL and to reverse engineer Java objects from the database or vice versa, which can be useful, but it's not required.
If you want to go the hibernate way, you should have a look at Gilead or its predecessor hibernate4gwt. It works pretty well, but documentation is a bit sparse.