Skip to content

Instantly share code, notes, and snippets.

@ivannov
ivannov / jcache-disappointment-2.adoc
Last active July 6, 2017 01:32
The disappointments I had during setting up jCache workshop for BG JUG

Now this is not really disappointment with jCache spec per se as it was my first one. It is more in the Hazelcast - Payara integration.

Note
the current version of Payara is working with Hazelcast 3.5.2. As far as I saw, the serialization implementation, which is the one that is heavily involved here, was changed a lot since then. So maybe all these issues were fixed.

So, as part of our workshop, we tried to showcase as well chapter 9 of the spec: Entry Processors. We wanted when a comment was put in our comments cache, it’s description to contain also the comment author at the end.

So we implemented our simple entry processor by the spec:

The usecase

I have this simple interface:

interface UserManager {

    User getUser(String userName, String password);

I have a user manager interface with two implementations:

interface UserManager {
  User findUserByName(String userName);
}

public class JPAUserManager {
https://github.com/bgjug/spring-boot-forge-addon
Vlado, Mihail:
setup command:
- parent (--version)
- dependency
- @SpringBootApplication class with main method
Ivan, Dido, Ivaylo:
enable jpa command:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="consultants-persistence-unit" transaction-type="JTA">
<description>Consultants Persistence Unit</description>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/DefaultDB</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,deleteTableContents')"/>
</properties>
<h:panelGrid columnClasses="label,component,required" columns="3">
<h:outputLabel for="personBeanPersonName" value="Name:"/>
<h:panelGroup>
<h:inputText id="personBeanPersonName" maxLength="100" value="#{personBean.person.name}"/>
<h:message for="personBeanPersonName" styleClass="error"/>
</h:panelGroup>
<h:outputText/>
<h:outputLabel for="personBeanPersonBio" value="Bio:"/>
<h:panelGroup>
<h:inputTextarea id="personBeanPersonBio" value="#{personBean.person.bio}"/>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="sports-tracker" transaction-type="JTA">
<description>Forge Persistence Unit</description>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
<property name="openjpa.ConnectionFactoryProperties" value="PrintParameters=true" />
</properties>
Apr 25, 2014 11:11:11 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\bin\eclipse-su\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/bin/eclipse-su/jre/bin/../jre/bin/client;C:/bin/eclipse-su/jre/bin/../jre/bin;C:/bin/eclipse-su/jre/bin/../jre/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files (x86)\Microsoft Application Virtualization Client;c:\Program Files (x86)\Open Text\View\bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Calibre2\;c:\bin\Java\jdk1.7.0_25\bin;c:\bin\ant-1.9.2\bin;c:\bin\maven-3.0.5\bin;c:\bin\jboss-as-7.1.1\bin;c:\bin\glassf