Does play2 framework uses ehcache wrapper on avaje ebeans bean cache? - javabeans

Does play2 framework uses ehcache wrapper on avaje ebeans bean cache ?
It seems to me that ehcache have to be more efficient, and it's not hard to implement wrapper around standart bean cache. But I don't know how play2 working with the bean cache itself.

According to the Ebean/Play integration, it does not seem that Play set any L2 cache for Ebean.
So Ebean must be using its default cache mechanism (com.avaje.ebeaninternal.server.cache.DefaultServerCache).

Related

Java Bean Mapper Framework in Spring

I am planning to use MapStruct as Java Bean Mapper Library into my project. But before choosing this, I would like to see any such library is there in the Spring framework. I could not able to find such, Can anyone confirm do we have any such library? If not, is MapStruct is the good option to use along with other Spring Framework libraries?

How should I set up a web project using Kotlin on the back-end and in the browser?

If I wanted to build a website which used Kotlin both on the back-end, and in the browser - how would I set this up? Is there a Maven archetype or a Gradle template that captures best-practices for something like this?
The easiest way is to keep the modules separate, and I guess conceptually you'd probably want to do that also. While IntelliJ IDEA for instance doesn't natively support the ability to output to JS and JVM with Kotlin, in principle with Gradle/Maven you could. Here are instructions on targeting JVM and JavaScript for Gradle http://kotlinlang.org/docs/reference/using-gradle.html

Mocking framework for osgi/eclipse applications?

I am looking for mocking framework to use in my osgi/eclipse test fragments. I have looked at:
http://www.jmock.org/download.html
but since its not osgi I need to convert it manually. I have tried to google for some mocking frameworks that works with osgi out of the box but have not been able to find any, does osgi developers not use mocking?
One solution will be to create mock objects of OSGi objects (like BundleContext and ServiceReference). You can use any mocking framework for this and of course you don't have to run the test in an OSGi container. This will be OK for simple scenarios.
If you want to test inside a container, you have the following options:
Pax-Exam
Spring DM Testing facilities
Actually Mockito works quite good with OSGI applications, since it has OSGI manifest. You can simply add it to your target platform from the latest orbit repository. I managed to make Powermock also working for Eclipse Plugins and it is available as well as update site at https://code.google.com/p/powermock-osgi/

Is there a Maven plugin to package Entity beans in J2EE app?

I haven't found a Maven plugin or target that will package my app and deploy it to Glassfish without error. I get this exception:
[ERROR] com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while preparing the app : java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-unit-ref-name [org.us.impl.MyClass/entityManagerFactory] in scope of the module called [man-java-really-stinks-app]. Please verify your application.
This isn't a Spring/Hibernate/EntityManagerFactory/Jpa problem. The app runs fine in the embedded Maven Glassfish container.
I changed packaging to ear in my pom.xml and got this when I deployed to Glassfish
Error during deployment : org.xml.sax.SAXParseException: The content of element type "application" is incomplete, it must match "(icon?,display-name,description?,module+,security-role*)".
IS there a plugin that will take care of the J2EE packaging requirements?
Bonus question: Since the Entities (just POJOS!) and the application need to be packaged differently, is it best to separate these into Maven sub-projects?
I haven't found a Maven plugin or target that will package my app and deploy it to Glassfish without error.
For the packaging, there is everything you need: the maven-jar-plugin for JARs (including JARs packaging JPA entities), the maven-war-plugin for WARs, the maven-ejb-plugin for EJB-JARs, the maven-ear-plugin for EARs, the maven-rar-plugin for resource adapters.
This isn't a Spring/Hibernate/EntityManagerFactory/Jpa problem. The app runs fine in the embedded Maven Glassfish container.
Well, I'm still tempted to say that there is a JPA configuration problem somewhere anyway, the container is clearly failing at finding a (default?) persistence unit. But since I have no idea of the kind of app you're running (I guess it's a webapp but would like to get confirmation), what your persistence.xml looks like, how you inject the EntityManager, how you configured the database access, how you configured Spring, the version of GlassFish you're running, etc, etc, it will be hard to say anything more.
I changed packaging to ear in my pom.xml and got this when I deployed to Glassfish
That's not that easy. Building an EAR typically involves a multi-modules build, and you are expected to provide a special deployment descriptor. But I'm not convinced you need an EAR packaging and if you can avoid it, don't use it.
IS there a plugin that will take care of the J2EE packaging requirements?
As I said, there are plugins for everything you need, from J2EE to Java EE 6. Just provide the details requested above.
Bonus question: Since the Entities (just POJOS!) and the application need to be packaged differently, is it best to separate these into Maven sub-projects?
Entities and the application do NOT (always) need to be packaged differently, you can package entities directly inside a WAR (I'm extrapolating but I suspect this is your case). I just think you have a configuration problem somewhere, even if the application is running in GF Embedded.
By the way, almost Everything is POJO in Java EE (Entities, Session Beans, Message Driven Beans, etc), but there is no direct consequence on packaging, packaging and POJOness are unrelated.
org.us.impl.MyClass had a #PersistenceUnit annotation. The persistince is managed by Spring, but Glassfish takes a sweep of the annotation classes and tries to resolve it itself. You can tell Glassfish to knock it off by adding
metadata-complete="true"
to your web.xml, like so
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true">
Further reading: https://glassfish.dev.java.net/issues/show_bug.cgi?id=4204

Using Grails GORM standalone

I'm currently wondering how it is possible to use the Groovy ORM Layer from Grails standalone outside of the Grails Framework. There is a Documentation Entry for doing so, but the ZIP file only links to an empty page. I downloaded Grails 1.2-M3 but I couldn't find anything in the docs either.
Does anybody know what the current state is and how to accomplish this?
AFAIK it is possible to use GORM standalone since Grails 1.1.
This allows you to use GORM as your ORM without using the full Grails framework
However, I don't think it's possible to use GORM outside of Spring (which is the foundation on which Grails is built). To summarise:
You can use GORM without using Grails
You cannot use GORM without using Spring
A sample application demonstrating how to use GORM outside Grails is available here. If you want to browse the source code of this example in a browser (instead of checking it out from the SVN repository), start here.
As of Grails 2.3.6, GORM is officially supported as a standalone module. See the release notes for more details.