CVE-2016-15018 (published 2023-01-15T19:15Z)

A vulnerability was found in krail-jpa up to 0.9.1. It has been classified as critical. This affects an unknown part. The manipulation leads to sql injection. Upgrading to version 0.9.2 is able to address this issue. The identifier of the patch is c1e848665492e21ef6cc9be443205e36b9a1f6be. It is recommended to upgrade the affected component. The identifier VDB-218373 was assigned to this vulnerability.

CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/KrailOrg/krail-jpa
commit_details: repo_url: https://github.com/KrailOrg/krail-jpa
author: David Sowerby
author_date: 2016-01-18 18:20:17+00:00
msg: Fix #18 SQLInjection vulnerability cleared

Pattern and Option DAOs re-written to a common key-value base class.  Using composite primary key in place of surrogate key.
repository: repo_url: https://github.com/KrailOrg/krail-jpa
repo_name: KrailOrg/krail-jpa
description: A JPA module for Krail
repo_language: Java
owner: KrailOrg
file_changes: filename: DefaultJpaPatternDao.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,57 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.i18n;
+
+import com.google.inject.Inject;
+import org.apache.onami.persist.EntityManagerProvider;
+import org.apache.onami.persist.PersistenceUnitModule;
+import uk.q3c.krail.i18n.PatternCacheKey;
+import uk.q3c.krail.jpa.persist.BaseJpaKeyValueDao;
+
+import javax.annotation.Nonnull;
+import java.util.Optional;
+
+/**
+ * The default implementation of {@link JpaPatternDao}.  The {@code entityManagerProvider} and {@code dao} are bound by {@link PersistenceUnitModule} to the
+ * annotation which is used in the injection of this class. (For example, if an instance of this class is annotated with @Jpa1, then the constructor parameters
+ * will also be bound with @Jpa1)
+ * <p>
+ * Created by David Sowerby on 15/04/15.
+ */
+public class DefaultJpaPatternDao extends BaseJpaKeyValueDao<PatternId, PatternCacheKey, JpaPatternEntity> implements JpaPatternDao {
+
+
+    @Inject
+    protected DefaultJpaPatternDao(EntityManagerProvider entityManagerProvider) {
+        super(entityManagerProvider, JpaPatternEntity.class);
+    }
+
+
+    @Override
+    protected JpaPatternEntity newEntity(PatternCacheKey cacheKey, String value) {
+        return new JpaPatternEntity(cacheKey, value);
+    }
+
+    @Override
+    protected PatternId newId(PatternCacheKey cacheKey) {
+        return new PatternId(cacheKey);
+    }
+
+
+    @Nonnull
+    @Override
+    public Optional<String> getValue(@Nonnull PatternCacheKey cacheKey) {
+        return getValueAsString(cacheKey);
+    }
+}

programming_language: Java
filename: DefaultJpaPatternDao_LongInt.java
change_type: ModificationType.DELETE
diff: @@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2015. David Sowerby
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package uk.q3c.krail.jpa.i18n;
-
-import com.google.inject.Inject;
-import org.apache.onami.persist.EntityManagerProvider;
-import org.apache.onami.persist.PersistenceUnitModule;
-import org.apache.onami.persist.Transactional;
-import uk.q3c.krail.core.data.Select;
-import uk.q3c.krail.i18n.PatternCacheKey;
-import uk.q3c.krail.jpa.persist.DefaultJpaDao_LongInt;
-
-import javax.annotation.Nonnull;
-import javax.persistence.TypedQuery;
-import java.util.List;
-import java.util.Optional;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * The default implementation of {@link JpaPatternDao}.  The {@code entityManagerProvider} and {@code dao} are bound by {@link PersistenceUnitModule} to the
- * annotation which is used in the injection of this class. (For example, if an instance of this class is annotated with @Jpa1, then the constructor parameters
- * will also be bound with @Jpa1)
- * <p>
- * Created by David Sowerby on 15/04/15.
- */
-public class DefaultJpaPatternDao_LongInt extends DefaultJpaDao_LongInt implements JpaPatternDao {
-
-    @Inject
-    protected DefaultJpaPatternDao_LongInt(EntityManagerProvider entityManagerProvider) {
-        super(entityManagerProvider);
-    }
-
-    @Transactional
-    @Override
-    public void write(@Nonnull PatternCacheKey cacheKey, @Nonnull String value) {
-        checkNotNull(cacheKey);
-        checkNotNull(value);
-        Optional<PatternEntity_LongInt> existingValue = find(cacheKey);
-        if (existingValue.isPresent()) {
-            existingValue.get()
-                         .setValue(value);
-            save(existingValue.get());
-        } else {
-            save(keyToEntity(cacheKey, value));
-        }
-    }
-
-    @Nonnull
-    protected PatternEntity_LongInt keyToEntity(@Nonnull PatternCacheKey key, @Nonnull String value) {
-        return new PatternEntity_LongInt(key, value);
-    }
-
-    @Transactional
-    @Override
-    @Nonnull
-    public Optional<PatternEntity_LongInt> find(@Nonnull PatternCacheKey cacheKey) {
-        checkNotNull(cacheKey);
-        Select select = selectEntity(cacheKey);
-
-        TypedQuery<PatternEntity_LongInt> query = getEntityManager().createQuery(select.toString(), PatternEntity_LongInt.class);
-        List<PatternEntity_LongInt> results = query.getResultList();
-        if (results.isEmpty()) {
-            return Optional.empty();
-        } else {
-            return Optional.of(results.get(0));
-        }
-    }
-
-    protected Select selectEntity(PatternCacheKey cacheKey) {
-        //ensure the same conversion as writing
-        PatternEntity_LongInt searchKey = new PatternEntity_LongInt(cacheKey, "x");
-        return new Select().from(entityName(PatternEntity_LongInt.class))
-                           .where("i18nkey", searchKey.getI18nkey())
-                           .and("locale", searchKey.getLocale());
-    }
-
-    @Transactional
-    @Nonnull
-    @Override
-    public Optional<String> deleteValue(@Nonnull PatternCacheKey cacheKey) {
-        checkNotNull(cacheKey);
-
-
-        TypedQuery<PatternEntity_LongInt> query = getEntityManager().createQuery(selectFromKey(cacheKey), PatternEntity_LongInt.class);
-        List<PatternEntity_LongInt> results = query.getResultList();
-        if (results.isEmpty()) {
-            return Optional.empty();
-        } else {
-            final Optional<PatternEntity_LongInt> patternEntity = deleteById(PatternEntity_LongInt.class, results.get(0)
-                                                                                                 .getId());
-            if (patternEntity.isPresent()) {
-                return Optional.of(patternEntity.get()
-                                                .getValue());
-            } else {
-                return Optional.empty();
-            }
-        }
-    }
-
-    /**
-     * Returns a Select String from the {@code cacheKey}.  Uses {@link PatternEntity_LongInt} to ensure conversion from key to entity is consistent for the esearch
-     * compared to the original write
-     *
-     * @param cacheKey
-     *         the key being selected
-     *
-     * @return a Select String from the {@code cacheKey}
-     */
-    protected String selectFromKey(@Nonnull PatternCacheKey cacheKey) {
-        PatternEntity_LongInt searchPattern = keyToEntity(cacheKey, "x");
-        return new Select().from(PatternEntity_LongInt.class)
-                           .where("i18nkey", searchPattern.getI18nkey())
-                           .and("locale", searchPattern.getLocale())
-                           .toString();
-    }
-
-    @Nonnull
-    @Override
-    public Optional<String> getValue(@Nonnull PatternCacheKey cacheKey) {
-        checkNotNull(cacheKey);
-        Optional<PatternEntity_LongInt> entity = find(cacheKey);
-        if (entity.isPresent()) {
-            return Optional.of(entity.get()
-                                     .getValue());
-        } else {
-            return Optional.empty();
-        }
-    }
-
-    /**
-     * returns the number of entries
-     *
-     * @return the number of entries
-     */
-    @Override
-    @Transactional
-    public long count() {
-        return super.count(PatternEntity_LongInt.class);
-    }
-
-
-}

programming_language: unknown
filename: JpaPatternDao.java
change_type: ModificationType.MODIFY
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.i18n;
@@ -14,8 +16,6 @@ package uk.q3c.krail.jpa.i18n;
 import uk.q3c.krail.i18n.PatternCacheKey;
 import uk.q3c.krail.i18n.PatternDao;
 
-import java.util.Optional;
-
 /**
  * JPA specific interface for {@link PatternDao} to enable binding alternatives
  * <p>
@@ -23,5 +23,5 @@ import java.util.Optional;
  */
 public interface JpaPatternDao extends PatternDao {
 
-    Optional<PatternEntity_LongInt> find(PatternCacheKey cacheKey);
+    JpaPatternEntity find(PatternCacheKey cacheKey);
 }

programming_language: Java
filename: JpaPatternEntity.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,70 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.i18n;
+
+import uk.q3c.krail.i18n.PatternCacheKey;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Version;
+
+/**
+ * An entity to represent an I18N key, Locale and value combination
+ * <p>
+ * Created by David Sowerby on 15/04/15.
+ */
+
+@Entity
+public class JpaPatternEntity implements KeyValueEntity<PatternId, Integer> {
+
+    @EmbeddedId
+    private PatternId id;
+    private String value;
+    @Version
+    private Integer version;
+
+    protected JpaPatternEntity() {
+    }
+
+    public JpaPatternEntity(PatternCacheKey cacheKey, String value) {
+        id = new PatternId(cacheKey);
+        this.value = value;
+    }
+
+    public String getI18nkey() {
+        return id.getI18nkey();
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getLocale() {
+        return id.getLocale();
+    }
+
+    @Override
+    public PatternId getId() {
+        return id;
+    }
+
+    @Override
+    public Integer getVersion() {
+        return version;
+    }
+}

programming_language: Java
filename: KeyValueEntity.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,26 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.i18n;
+
+import uk.q3c.krail.core.data.KrailEntity;
+
+/**
+ * Created by David Sowerby on 18 Jan 2016
+ */
+public interface KeyValueEntity<ID, VER> extends KrailEntity<ID, VER> {
+
+    String getValue();
+
+    void setValue(String value);
+}

programming_language: Java
filename: PatternEntity_LongInt.java
change_type: ModificationType.DELETE
diff: @@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2015. David Sowerby
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package uk.q3c.krail.jpa.i18n;
-
-import uk.q3c.krail.core.data.EnumConverter;
-import uk.q3c.krail.i18n.PatternCacheKey;
-import uk.q3c.krail.jpa.persist.EntityBase_LongInt;
-
-import javax.persistence.Entity;
-
-/**
- * An entity to represent an I18N key, Locale and value combination
- * <p>
- * Created by David Sowerby on 15/04/15.
- */
-
-@Entity
-public class PatternEntity_LongInt extends EntityBase_LongInt {
-
-    private String i18nkey;
-    private String locale;
-    private String value;
-
-    public PatternEntity_LongInt() {
-    }
-
-    public PatternEntity_LongInt(PatternCacheKey cacheKey, String value) {
-        final Enum<?> enumKey = cacheKey.getKey();
-        this.i18nkey = new EnumConverter().convertToString(enumKey);
-        this.locale = cacheKey.getRequestedLocale()
-                              .toLanguageTag();
-        this.value = value;
-    }
-
-    public String getI18nkey() {
-        return i18nkey;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    public String getLocale() {
-        return locale;
-    }
-}

programming_language: unknown
filename: PatternId.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,69 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.i18n;
+
+import uk.q3c.krail.core.data.EnumConverter;
+import uk.q3c.krail.i18n.PatternCacheKey;
+
+import javax.annotation.Nonnull;
+import javax.persistence.Embeddable;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Created by David Sowerby on 17 Jan 2016
+ */
+@Embeddable
+public class PatternId {
+    private String i18nkey;
+    private String locale;
+
+    protected PatternId() {
+
+    }
+
+    public PatternId(@Nonnull PatternCacheKey cacheKey) {
+        checkNotNull(cacheKey);
+        final Enum<?> enumKey = cacheKey.getKey();
+        this.i18nkey = new EnumConverter().convertToString(enumKey);
+        this.locale = cacheKey.getRequestedLocale()
+                              .toLanguageTag();
+    }
+
+    public String getI18nkey() {
+        return i18nkey;
+    }
+
+    public String getLocale() {
+        return locale;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        PatternId that = (PatternId) o;
+
+        if (!i18nkey.equals(that.i18nkey)) return false;
+        return locale.equals(that.locale);
+
+    }
+
+    @Override
+    public int hashCode() {
+        int result = i18nkey.hashCode();
+        return 31 * result + locale.hashCode();
+    }
+}

programming_language: Java
filename: BaseJpaDao.java
change_type: ModificationType.MODIFY
diff: @@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.persist;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.apache.onami.persist.EntityManagerProvider;
 import org.apache.onami.persist.Transactional;
 import org.eclipse.persistence.config.PersistenceUnitProperties;
@@ -138,6 +141,8 @@ public abstract class BaseJpaDao<ID, VER> implements JpaDao<ID, VER> {
     /**
      * {@inheritDoc}
      */
+    @SuppressFBWarnings("SQL_INJECTION_JPA")
+    // The only parameter is entityName(), which is limited to either the simple class name of the entity, or its annotation
     @Nonnull
     @Override
     public <E extends KrailEntity<ID, VER>> List<E> findAll(@Nonnull Class<E> entityClass) {
@@ -153,7 +158,7 @@ public abstract class BaseJpaDao<ID, VER> implements JpaDao<ID, VER> {
      */
     @Override
     @Nonnull
-    public <E extends KrailEntity<ID, VER>> String entityName(@Nonnull Class<E> entityClass) {
+    public final <E extends KrailEntity<ID, VER>> String entityName(@Nonnull Class<E> entityClass) {
         checkNotNull(entityClass);
 
         // Get the @Entity annotation to check for name change
@@ -186,8 +191,11 @@ public abstract class BaseJpaDao<ID, VER> implements JpaDao<ID, VER> {
 
 
     /**
-     * {@inheritDoc}
+     *
      */
+
+    @SuppressFBWarnings("SQL_INJECTION_JPA")
+    // The only parameter is entityName(), which is limited to either the simple class name of the entity, or its annotation
     @Transactional
     @Override
     public <E extends KrailEntity<ID, VER>> long count(@Nonnull Class<E> entityClass) {

programming_language: Java
filename: BaseJpaKeyValueDao.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,100 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.persist;
+
+import org.apache.onami.persist.EntityManagerProvider;
+import org.apache.onami.persist.Transactional;
+import uk.q3c.krail.jpa.i18n.KeyValueEntity;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Optional;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * A common base class for Pattern and Option DAOs, which both require a key-value type of implementation
+ * <p>
+ * Created by David Sowerby on 18 Jan 2016
+ */
+public abstract class BaseJpaKeyValueDao<ID, K, E extends KeyValueEntity<ID, Integer>> extends BaseJpaDao<ID, Integer> implements JpaKeyValueDao<ID, Integer, K,
+        E> {
+
+    private Class<E> entityClass;
+
+    public BaseJpaKeyValueDao(EntityManagerProvider entityManagerProvider, Class<E> entityClass) {
+        super(entityManagerProvider);
+        this.entityClass = entityClass;
+    }
+
+    @Transactional
+    @Override
+    public E write(@Nonnull K cacheKey, @Nonnull String value) {
+        checkNotNull(cacheKey);
+        checkNotNull(value);
+        E existingEntity = find(cacheKey);
+        if (existingEntity != null) {
+            existingEntity.setValue(value);
+            return save(existingEntity);
+        } else {
+            return save(newEntity(cacheKey, value));
+        }
+    }
+
+    protected abstract E newEntity(K cacheKey, String value);
+
+    protected abstract ID newId(K cacheKey);
+
+    @Transactional
+    @Override
+    @Nullable
+    public E find(@Nonnull K cacheKey) {
+        checkNotNull(cacheKey);
+        return getEntityManager().find(entityClass, newId(cacheKey));
+    }
+
+    @Transactional
+    @Nonnull
+    @Override
+    public Optional<String> deleteValue(@Nonnull K cacheKey) {
+        checkNotNull(cacheKey);
+        Optional<E> deletedItem = deleteById(entityClass, newId(cacheKey));
+        if (deletedItem.isPresent()) {
+            return Optional.of(deletedItem.get()
+                                          .getValue());
+        } else {
+            return Optional.empty();
+        }
+    }
+
+    @Nonnull
+    @Override
+    public Optional<String> getValueAsString(@Nonnull K cacheKey) {
+        checkNotNull(cacheKey);
+        E entity = find(cacheKey);
+        return (entity == null) ? Optional.empty() : Optional.of(entity.getValue());
+    }
+
+    /**
+     * returns the number of entries
+     *
+     * @return the number of entries
+     */
+    @Override
+    @Transactional
+    public long count() {
+        return super.count(entityClass);
+    }
+
+}

programming_language: Java
filename: DefaultJpaInstanceConfiguration.java
change_type: ModificationType.MODIFY
diff: @@ -19,8 +19,8 @@ import org.eclipse.persistence.jpa.PersistenceProvider;
 import uk.q3c.krail.core.user.opt.OptionDao;
 import uk.q3c.krail.i18n.I18NKey;
 import uk.q3c.krail.i18n.PatternDao;
-import uk.q3c.krail.jpa.i18n.DefaultJpaPatternDao_LongInt;
-import uk.q3c.krail.jpa.user.opt.DefaultOptionJpaDao_LongInt;
+import uk.q3c.krail.jpa.i18n.DefaultJpaPatternDao;
+import uk.q3c.krail.jpa.user.opt.DefaultJpaOptionDao;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -198,7 +198,7 @@ public class DefaultJpaInstanceConfiguration extends HashMap<String, Object> imp
      */
     @Override
     public DefaultJpaInstanceConfiguration provideOptionDao() {
-        bind(OptionDao.class, DefaultOptionJpaDao_LongInt.class);
+        bind(OptionDao.class, DefaultJpaOptionDao.class);
         provideOptionDao = true;
         return this;
     }
@@ -209,7 +209,7 @@ public class DefaultJpaInstanceConfiguration extends HashMap<String, Object> imp
      */
     @Override
     public DefaultJpaInstanceConfiguration providePatternDao() {
-        bind(PatternDao.class, DefaultJpaPatternDao_LongInt.class);
+        bind(PatternDao.class, DefaultJpaPatternDao.class);
         providePatternDao = true;
         return this;
     }

programming_language: Java
filename: JpaKeyValueDao.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,43 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.persist;
+
+import org.apache.onami.persist.Transactional;
+import uk.q3c.krail.jpa.i18n.KeyValueEntity;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.Optional;
+
+/**
+ * Created by David Sowerby on 18 Jan 2016
+ */
+public interface JpaKeyValueDao<ID, VER, K, E extends KeyValueEntity> extends JpaDao<ID, VER> {
+    @Transactional
+    E write(@Nonnull K cacheKey, @Nonnull String value);
+
+    @Transactional
+    @Nullable
+    E find(@Nonnull K cacheKey);
+
+    @Transactional
+    @Nonnull
+    Optional<String> deleteValue(@Nonnull K cacheKey);
+
+    @Nonnull
+    Optional<String> getValueAsString(@Nonnull K cacheKey);
+
+    @Transactional
+    long count();
+}

programming_language: Java
filename: DefaultJpaOptionContainerProvider.java
change_type: ModificationType.MODIFY
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.user.opt;
@@ -38,6 +40,6 @@ public class DefaultJpaOptionContainerProvider implements JpaOptionContainerProv
 
     @Override
     public Container get(ContainerType containerType) {
-        return jpaContainerProvider.get(OptionEntity_LongInt.class, containerType);
+        return jpaContainerProvider.get(JpaOptionEntity.class, containerType);
     }
 }

programming_language: Java
filename: DefaultJpaOptionDao.java
change_type: ModificationType.RENAME
diff: @@ -13,9 +13,9 @@
 
 package uk.q3c.krail.jpa.user.opt;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.inject.Inject;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.apache.onami.persist.EntityManagerProvider;
 import org.apache.onami.persist.PersistenceUnitModule;
 import org.apache.onami.persist.Transactional;
@@ -23,25 +23,22 @@ import uk.q3c.krail.core.data.OptionStringConverter;
 import uk.q3c.krail.core.data.Select;
 import uk.q3c.krail.core.user.opt.Option;
 import uk.q3c.krail.core.user.opt.OptionDao;
-import uk.q3c.krail.core.user.opt.OptionException;
 import uk.q3c.krail.core.user.opt.cache.DefaultOptionCacheLoader;
 import uk.q3c.krail.core.user.opt.cache.OptionCache;
 import uk.q3c.krail.core.user.opt.cache.OptionCacheKey;
 import uk.q3c.krail.core.user.profile.RankOption;
-import uk.q3c.krail.jpa.persist.DefaultJpaDao_LongInt;
+import uk.q3c.krail.jpa.persist.BaseJpaKeyValueDao;
 
 import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
 import java.util.List;
 import java.util.Optional;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static uk.q3c.krail.core.data.Select.Compare.EQ;
 import static uk.q3c.krail.core.user.profile.RankOption.SPECIFIC_RANK;
 
 /**
- * Converts {@link OptionCacheKey} to {@link OptionEntity_LongInt} for persistence.
+ * Converts {@link OptionCacheKey} to {@link JpaOptionEntity} for persistence.
  *
  * Injected automatically with the correct {@link EntityManagerProvider} (where correct == annotated the same as this instance).  This is done by the {@link
  * PersistenceUnitModule}
@@ -51,65 +48,21 @@ import static uk.q3c.krail.core.user.profile.RankOption.SPECIFIC_RANK;
  * <br>
  * Created by David Sowerby on 13/04/15.
  */
-public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implements OptionJpaDao_LongInt {
+public class DefaultJpaOptionDao extends BaseJpaKeyValueDao<OptionId, OptionCacheKey, JpaOptionEntity> implements JpaOptionDao {
 
 
     private OptionStringConverter optionStringConverter;
 
     @Inject
-    protected DefaultOptionJpaDao_LongInt(EntityManagerProvider entityManagerProvider, OptionStringConverter optionStringConverter) {
-        super(entityManagerProvider);
+    protected DefaultJpaOptionDao(EntityManagerProvider entityManagerProvider, OptionStringConverter optionStringConverter) {
+        super(entityManagerProvider, JpaOptionEntity.class);
         this.optionStringConverter = optionStringConverter;
     }
 
-    @Override
-    @Transactional
-    @Nonnull
-    public <V> Object write(@Nonnull OptionCacheKey cacheKey, @Nonnull Optional<V> value) {
-        checkRankOption(cacheKey, SPECIFIC_RANK);
-        Preconditions.checkArgument(value.isPresent(), "Value must be non-empty");
-        EntityManager entityManager = getEntityManager();
-        // is there an existing entity (bearing in mind that the id field is not the same as the key field
-        String stringValue = optionStringConverter.convertValueToString(value.get());
 
 
-        Optional<OptionEntity_LongInt> existingEntity = find(cacheKey);
-        if (existingEntity.isPresent()) {
-            OptionEntity_LongInt existing = existingEntity.get();
-            existing
-                          .setValue(stringValue);
-            entityManager.persist(existingEntity.get());
-            return existing;
-        } else {
-            //noinspection ConstantConditions
-            final OptionEntity_LongInt entity = new OptionEntity_LongInt(cacheKey, stringValue);
-            entityManager.persist(entity);
-            return entity;
-        }
-
-    }
-
-    @Transactional
-    @Nonnull
-    public Optional<OptionEntity_LongInt> find(@Nonnull OptionCacheKey cacheKey) {
-        checkRankOption(cacheKey, SPECIFIC_RANK);
-
-        Select select = selectSingleRank(cacheKey);
-
-        TypedQuery<OptionEntity_LongInt> query = getEntityManager().createQuery(select.statement(), OptionEntity_LongInt.class);
-        List<OptionEntity_LongInt> results = query.getResultList();
-        if (results.isEmpty()) {
-            return Optional.empty();
-        } else {
-            if (results.size() > 1) {
-                throw new OptionException("Multiple values for one cache key found, cacheKey =  " + cacheKey);
-            }
-            return Optional.of(results.get(0));
-        }
-    }
-
     protected Select selectSingleRank(@Nonnull OptionCacheKey cacheKey) {
-        return new Select().from(entityName(OptionEntity_LongInt.class))
+        return new Select().from(entityName(JpaOptionEntity.class))
                            .where("userHierarchyName", EQ, cacheKey.getHierarchy()
                                                                    .persistenceName())
                            .and("rankName", EQ, cacheKey.getRequestedRankName())
@@ -117,22 +70,6 @@ public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implement
                                                          .compositeKey());
     }
 
-    @Transactional
-    @Nonnull
-    @Override
-    public Optional<?> deleteValue(@Nonnull OptionCacheKey cacheKey) {
-        checkRankOption(cacheKey, SPECIFIC_RANK);
-        final Optional<OptionEntity_LongInt> entity = find(cacheKey);
-        if (entity.isPresent()) {
-            String entityValue = entity.get()
-                                       .getValue();
-            delete(entity.get());
-            return Optional.of(entityValue);
-        } else {
-            return Optional.empty();
-        }
-    }
-
     @Nonnull
     @Override
     public Optional<?> getHighestRankedValue(@Nonnull final OptionCacheKey cacheKey) {
@@ -143,6 +80,7 @@ public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implement
         return findFirstRankedValue(cacheKey, ranks);
     }
 
+
     /**
      * Returns the first value found from the ordered {@code ranks}
      *
@@ -165,20 +103,20 @@ public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implement
         return value;
     }
 
+    @Override
+    public <V> Object write(@Nonnull OptionCacheKey cacheKey, @Nonnull Optional<V> value) {
+        checkRankOption(cacheKey, SPECIFIC_RANK);
+        checkArgument(value.isPresent(), "Value must be present");
+        String stringValue = optionStringConverter.convertValueToString(value.get());
+        return write(cacheKey, stringValue);
+    }
+
     @Nonnull
     @Override
     public Optional<?> getValue(@Nonnull OptionCacheKey cacheKey) {
         checkRankOption(cacheKey, SPECIFIC_RANK);
-        final Optional<OptionEntity_LongInt> optionalEntity = find(cacheKey);
-        if (optionalEntity.isPresent()) {
-
-            String value = optionalEntity.get()
-                                         .getValue();
-
-            return Optional.of(optionStringConverter.convertStringToValue(cacheKey, value));
-        } else {
-            return Optional.empty();
-        }
+        Optional<String> v = getValueAsString(cacheKey);
+        return (v.isPresent()) ? Optional.of(optionStringConverter.convertStringToValue(cacheKey, v.get())) : Optional.empty();
     }
 
 
@@ -196,11 +134,23 @@ public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implement
     /**
      * {@inheritDoc}
      */
+    @SuppressFBWarnings("SQL_INJECTION_JPA")//entityName() is final and can only return SimpleClassName of annotation
+    @SuppressWarnings("JpaQlInspection")
     @Transactional
     @Override
     public int clear() {
-        final Query query = getEntityManager().createQuery("DELETE FROM " + entityName(OptionEntity_LongInt.class));
-        return query.executeUpdate();
+        return getEntityManager().createQuery("DELETE FROM " + entityName(JpaOptionEntity.class))
+                                 .executeUpdate();
+    }
+
+    @Override
+    protected JpaOptionEntity newEntity(OptionCacheKey cacheKey, String value) {
+        return new JpaOptionEntity(cacheKey, value);
+    }
+
+    @Override
+    protected OptionId newId(OptionCacheKey cacheKey) {
+        return new OptionId(cacheKey);
     }
 
     /**
@@ -208,7 +158,7 @@ public class DefaultOptionJpaDao_LongInt extends DefaultJpaDao_LongInt implement
      */
     @Override
     public long count() {
-        return super.count(OptionEntity_LongInt.class);
+        return super.count(JpaOptionEntity.class);
     }
 
 

programming_language: Java
filename: JpaOptionDao.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,31 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.user.opt;
+
+import org.apache.onami.persist.Transactional;
+import uk.q3c.krail.core.user.opt.OptionDao;
+import uk.q3c.krail.core.user.opt.cache.OptionCacheKey;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Created by David Sowerby on 13/04/15.
+ */
+public interface JpaOptionDao extends OptionDao {
+
+    @Transactional
+    @Nullable
+    JpaOptionEntity find(@Nonnull OptionCacheKey cacheKey);
+}

programming_language: Java
filename: JpaOptionEntity.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,89 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.user.opt;
+
+import uk.q3c.krail.core.user.opt.Option;
+import uk.q3c.krail.core.user.opt.cache.OptionCacheKey;
+import uk.q3c.krail.jpa.i18n.KeyValueEntity;
+
+import javax.annotation.Nonnull;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Version;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * An entity to hold data for an {@link Option}.  The value is held as a String to enable the use of a single column for it.  Context is part of the overall
+ * {#optionKey} to ensure uniqueness, but is also held separately as it is a useful way to group the options for manual setting up, and there may also be an
+ * opportunity to pre-load options by Context.
+ * <p>
+ * Created by David Sowerby on 13/04/15.
+ */
+@Entity
+public class JpaOptionEntity implements KeyValueEntity<OptionId, Integer> {
+
+    @EmbeddedId
+    private OptionId id;
+    private String value;
+    @Version
+    private Integer version;
+
+    protected JpaOptionEntity() {
+    }
+
+    public JpaOptionEntity(@Nonnull OptionCacheKey optionCacheKey, @Nonnull String value) {
+        this.id = new OptionId(optionCacheKey);
+        this.value = value;
+
+    }
+
+    @Override
+    public OptionId getId() {
+        return id;
+    }
+
+    @Override
+    public Integer getVersion() {
+        return version;
+    }
+
+    public String getContext() {
+        return id.getContext();
+    }
+
+    public String getUserHierarchyName() {
+        return id.getUserHierarchyName();
+    }
+
+    public String getRankName() {
+        return id.getRankName();
+    }
+
+    public String getOptionKey() {
+        return id.getOptionKey();
+    }
+
+    @Nonnull
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(@Nonnull String value) {
+        checkNotNull(value);
+        this.value = value;
+    }
+
+
+}

programming_language: Java
filename: OptionEntity_LongInt.java
change_type: ModificationType.DELETE
diff: @@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2015. David Sowerby
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package uk.q3c.krail.jpa.user.opt;
-
-import uk.q3c.krail.core.user.opt.Option;
-import uk.q3c.krail.core.user.opt.cache.OptionCacheKey;
-import uk.q3c.krail.jpa.persist.EntityBase_LongInt;
-
-import javax.annotation.Nonnull;
-import javax.persistence.Entity;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An entity to hold data for an {@link Option}.  The value is held as a String to enable the use of a single column for it.  Context is part of the overall
- * {#optionKey} to ensure uniqueness, but is also held separately as it is a useful way to group the options for manual setting up, and there may also be an
- * opportunity to pre-load options by Context.
- * <p>
- * Created by David Sowerby on 13/04/15.
- */
-@Entity
-public class OptionEntity_LongInt extends EntityBase_LongInt {
-
-    private String context;
-    private String optionKey;
-    private String rankName;
-    private String userHierarchyName;
-    private String value;
-
-    public OptionEntity_LongInt() {
-    }
-
-    public OptionEntity_LongInt(@Nonnull OptionCacheKey optionCacheKey, @Nonnull String value) {
-        userHierarchyName = optionCacheKey.getHierarchy()
-                                          .persistenceName();
-        rankName = optionCacheKey.getRequestedRankName();
-        optionKey = optionCacheKey.getOptionKey()
-                                  .compositeKey();
-        context = optionCacheKey.getOptionKey()
-                                .getContext()
-                                .getName();
-        this.value = value;
-
-    }
-
-    public String getContext() {
-        return context;
-    }
-
-    public String getUserHierarchyName() {
-        return userHierarchyName;
-    }
-
-    public void setUserHierarchyName(String userHierarchyName) {
-        this.userHierarchyName = userHierarchyName;
-    }
-
-    public String getRankName() {
-        return rankName;
-    }
-
-    public void setRankName(String rankName) {
-        this.rankName = rankName;
-    }
-
-    public String getOptionKey() {
-        return optionKey;
-    }
-
-    public void setOptionKey(String optionKey) {
-        this.optionKey = optionKey;
-    }
-
-    @Nonnull
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(@Nonnull String value) {
-        checkNotNull(value);
-        this.value = value;
-    }
-
-
-}

programming_language: unknown
filename: OptionId.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,84 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.user.opt;
+
+import uk.q3c.krail.core.user.opt.cache.OptionCacheKey;
+
+import javax.persistence.Embeddable;
+
+/**
+ * Created by David Sowerby on 17 Jan 2016
+ */
+@Embeddable
+public class OptionId {
+
+
+    private String context;
+    private String optionKey;
+    private String rankName;
+    private String userHierarchyName;
+
+    protected OptionId() {
+
+    }
+
+    public OptionId(OptionCacheKey optionCacheKey) {
+        userHierarchyName = optionCacheKey.getHierarchy()
+                                          .persistenceName();
+        rankName = optionCacheKey.getRequestedRankName();
+        optionKey = optionCacheKey.getOptionKey()
+                                  .compositeKey();
+        context = optionCacheKey.getOptionKey()
+                                .getContext()
+                                .getName();
+    }
+
+    public String getContext() {
+        return context;
+    }
+
+    public String getOptionKey() {
+        return optionKey;
+    }
+
+    public String getRankName() {
+        return rankName;
+    }
+
+    public String getUserHierarchyName() {
+        return userHierarchyName;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        OptionId optionId = (OptionId) o;
+
+        if (context != null ? !context.equals(optionId.context) : optionId.context != null) return false;
+        if (optionKey != null ? !optionKey.equals(optionId.optionKey) : optionId.optionKey != null) return false;
+        if (rankName != null ? !rankName.equals(optionId.rankName) : optionId.rankName != null) return false;
+        return userHierarchyName != null ? userHierarchyName.equals(optionId.userHierarchyName) : optionId.userHierarchyName == null;
+
+    }
+
+    @Override
+    public int hashCode() {
+        int result = context != null ? context.hashCode() : 0;
+        result = 31 * result + (optionKey != null ? optionKey.hashCode() : 0);
+        result = 31 * result + (rankName != null ? rankName.hashCode() : 0);
+        return 31 * result + (userHierarchyName != null ? userHierarchyName.hashCode() : 0);
+    }
+}

programming_language: Java
filename: OptionJpaDao_LongInt.java
change_type: ModificationType.DELETE
diff: @@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015. David Sowerby
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package uk.q3c.krail.jpa.user.opt;
-
-import uk.q3c.krail.core.user.opt.OptionDao;
-
-/**
- * Created by David Sowerby on 13/04/15.
- */
-public interface OptionJpaDao_LongInt extends OptionDao {
-
-}

programming_language: unknown
filename: DefaultJpaPatternDao__IntegrationTest.groovy
change_type: ModificationType.RENAME
diff: @@ -1,16 +1,17 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.i18n
-
 import com.google.inject.Inject
 import org.apache.onami.persist.PersistenceService
 import org.apache.onami.persist.UnitOfWork
@@ -23,7 +24,7 @@ import uk.q3c.krail.i18n.PatternDao
 import uk.q3c.krail.jpa.persist.Jpa1
 
 @UseModules([TestPatternJpaModule, DataModule])
-class DefaultJpaPatternDao_LongInt_IntegrationTest extends Specification {
+class DefaultJpaPatternDao__IntegrationTest extends Specification {
 
     @Inject
     @Jpa1
@@ -53,10 +54,10 @@ class DefaultJpaPatternDao_LongInt_IntegrationTest extends Specification {
     def "setting up"() {
         expect:
         persistenceService != null
-        persistenceService.isRunning() == true
+        persistenceService.isRunning()
 
         unitOfWork != null
-        unitOfWork.isActive() == true
+        unitOfWork.isActive()
 
         dao != null
 
@@ -69,11 +70,11 @@ class DefaultJpaPatternDao_LongInt_IntegrationTest extends Specification {
         PatternCacheKey cacheKey = new PatternCacheKey(LabelKey.Yes, Locale.UK);
         when:
         dao.write(cacheKey, "4");
-        Optional<PatternEntity_LongInt> actual = (Optional<PatternEntity_LongInt>) dao.find(cacheKey)
+        JpaPatternEntity actual = dao.find(cacheKey)
         then:
-        actual.isPresent()
+        actual != null
         dao.count() == 1
-        actual.get().getValue() == "4"
+        actual.getValue() == "4"
     }
 
 
@@ -84,13 +85,12 @@ class DefaultJpaPatternDao_LongInt_IntegrationTest extends Specification {
         dao.write(cacheKey, "4");
         dao.write(cacheKey, "5");
         dao.write(cacheKey, "6");
-        Optional<PatternEntity_LongInt> actual = (Optional<PatternEntity_LongInt>) dao.find(cacheKey)
+        JpaPatternEntity actual = dao.find(cacheKey)
 
         then:
-        actual.isPresent()
+        actual != null
         dao.count() == 1
-        actual.isPresent()
-        actual.get().getValue() == "6"
+        actual.getValue() == "6"
 
     }
 
@@ -112,14 +112,14 @@ class DefaultJpaPatternDao_LongInt_IntegrationTest extends Specification {
         when:
 
         dao.deleteValue(cacheKey1)
-        Optional<PatternEntity_LongInt> result2 = dao.find(cacheKey2)
-        Optional<PatternEntity_LongInt> result3 = dao.find(cacheKey3)
+        JpaPatternEntity result2 = dao.find(cacheKey2)
+        JpaPatternEntity result3 = dao.find(cacheKey3)
 
         then:
 
         dao.count() == 2
-        result2.get().getValue() == "4"
-        result3.get().getValue() == "5"
+        result2.getValue() == "4"
+        result3.getValue() == "5"
 
 
     }

programming_language: Scala
filename: JpaPatternEntity_Test.groovy
change_type: ModificationType.ADD
diff: @@ -0,0 +1,42 @@
+/*
+ *
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
+ *
+ */
+
+package uk.q3c.krail.jpa.i18n
+
+import spock.lang.Specification
+import uk.q3c.krail.i18n.LabelKey
+import uk.q3c.krail.i18n.PatternCacheKey
+
+/**
+ * Created by David Sowerby on 13/07/15.
+ */
+class JpaPatternEntity_Test extends Specification {
+
+
+    JpaPatternEntity entity;
+
+    def "create decodes the I18NKey"() {
+        given:
+
+        PatternCacheKey cacheKey1 = new PatternCacheKey(LabelKey.Yes, Locale.UK)
+
+        when:
+
+        entity = new JpaPatternEntity(cacheKey1, "x")
+
+
+        then:
+
+        entity.getI18nkey().equals("uk.q3c.krail.i18n.LabelKey.Yes")
+    }
+}

programming_language: Scala
filename: PatternEntity_LongIntTest.groovy
change_type: ModificationType.DELETE
diff: @@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015. David Sowerby
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
-package uk.q3c.krail.jpa.i18n
-
-import spock.lang.Specification
-import uk.q3c.krail.i18n.LabelKey
-import uk.q3c.krail.i18n.PatternCacheKey
-
-/**
- * Created by David Sowerby on 13/07/15.
- */
-class PatternEntity_LongIntTest extends Specification {
-
-
-    PatternEntity_LongInt entity;
-
-    def "create decodes the I18NKey"() {
-        given:
-
-        PatternCacheKey cacheKey1 = new PatternCacheKey(LabelKey.Yes, Locale.UK)
-
-        when:
-
-        entity = new PatternEntity_LongInt(cacheKey1, "x")
-
-
-        then:
-
-        entity.getI18nkey().equals("uk.q3c.krail.i18n.LabelKey.Yes")
-    }
-}

programming_language: unknown
filename: TestJpaModule.java
change_type: ModificationType.MODIFY
diff: @@ -1,22 +1,24 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.persist;
 
 import org.apache.onami.persist.PersistenceUnitModuleConfiguration;
 import org.junit.rules.TemporaryFolder;
-import uk.q3c.krail.jpa.i18n.DefaultJpaPatternDao_LongInt;
+import uk.q3c.krail.jpa.i18n.DefaultJpaPatternDao;
 import uk.q3c.krail.jpa.i18n.JpaPatternDao;
-import uk.q3c.krail.jpa.user.opt.DefaultOptionJpaDao_LongInt;
-import uk.q3c.krail.jpa.user.opt.OptionJpaDao_LongInt;
+import uk.q3c.krail.jpa.user.opt.DefaultJpaOptionDao;
+import uk.q3c.krail.jpa.user.opt.JpaOptionDao;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -82,9 +84,9 @@ public class TestJpaModule extends JpaModule {
               .password("test")
               .ddlGeneration(DefaultJpaInstanceConfiguration.Ddl.DROP_AND_CREATE)
               .
-                      bind(OptionJpaDao_LongInt.class, DefaultOptionJpaDao_LongInt.class)
+                      bind(JpaOptionDao.class, DefaultJpaOptionDao.class)
               .bind(JpaDao_LongInt.class, DefaultJpaDao_LongInt.class)
-              .bind(JpaPatternDao.class, DefaultJpaPatternDao_LongInt.class);
+              .bind(JpaPatternDao.class, DefaultJpaPatternDao.class);
 
         return config;
     }

programming_language: Java
filename: DefaultJpaOptionDaoTest.groovy
change_type: ModificationType.RENAME
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.user.opt
@@ -29,11 +31,11 @@ import javax.persistence.TypedQuery
 
 /**
  *
- * Test for {@link uk.q3c.krail.jpa.user.opt.DefaultOptionJpaDao_LongInt}
+ * Test for {@link DefaultJpaOptionDao}
  *
  * Created by David Sowerby on 10/07/15.
  */
-class DefaultOptionJpaDao_LongIntTest extends Specification {
+class DefaultJpaOptionDaoTest extends Specification {
 
 
     ConverterFactory converterFactory = new DefaultConverterFactory()
@@ -46,13 +48,13 @@ class DefaultOptionJpaDao_LongIntTest extends Specification {
 
     UserHierarchy userHierarchy = Mock()
 
-    TypedQuery<OptionEntity_LongInt> query = Mock()
+    TypedQuery<JpaOptionEntity> query = Mock()
 
-    List<OptionEntity_LongInt> emptyResultList;
+    List<JpaOptionEntity> emptyResultList;
 
     OptionKey optionKey1 = Mock()
 
-    DefaultOptionJpaDao_LongInt dao
+    DefaultJpaOptionDao dao
 
 
     def setup() {
@@ -62,7 +64,7 @@ class DefaultOptionJpaDao_LongIntTest extends Specification {
         emptyResultList = new ArrayList<>()
         userHierarchy.persistenceName() >> "simple"
         userHierarchy.rankName(_) >> "ds"
-        dao = new DefaultOptionJpaDao_LongInt(entityManagerProvider, stringPersistenceConverter)
+        dao = new DefaultJpaOptionDao(entityManagerProvider, stringPersistenceConverter)
     }
 
     def "Write should throw an OptionKeyException if OptionKey rank is not specific"() {
@@ -95,15 +97,15 @@ class DefaultOptionJpaDao_LongIntTest extends Specification {
         then:
         1 * entityManager.persist(_)
         entity != null
-        entity instanceof OptionEntity_LongInt
-        OptionEntity_LongInt rEntity = (OptionEntity_LongInt) entity
+        entity instanceof JpaOptionEntity
+        JpaOptionEntity rEntity = (JpaOptionEntity) entity
         rEntity.getValue() == "3"
 
     }
 
     def "Write the second time should change the value of the existing OptionEntity and persist it"() {
         given:
-        List<OptionEntity_LongInt> resultList = new ArrayList<>();
+        List<JpaOptionEntity> resultList = new ArrayList<>();
         OptionCacheKey cacheKey = new OptionCacheKey(userHierarchy, RankOption.SPECIFIC_RANK, optionKey1)
         emptyResultList = new ArrayList<>()
         query.getResultList() >> emptyResultList
@@ -113,14 +115,14 @@ class DefaultOptionJpaDao_LongIntTest extends Specification {
 
         when:
         Object entity = dao.write(cacheKey, Optional.of(3))
-        resultList.add((OptionEntity_LongInt) entity)
+        resultList.add((JpaOptionEntity) entity)
         entity = dao.write(cacheKey, Optional.of(5))
 
         then:
         2 * entityManager.persist(_)
         entity != null
-        entity instanceof OptionEntity_LongInt
-        OptionEntity_LongInt rEntity = (OptionEntity_LongInt) entity
+        entity instanceof JpaOptionEntity
+        JpaOptionEntity rEntity = (JpaOptionEntity) entity
         rEntity.getValue() == "5"
 
     }

programming_language: Scala
filename: DefaultJpaOptionDao__DataTypeTest.groovy
change_type: ModificationType.RENAME
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.user.opt
@@ -38,7 +40,7 @@ import static uk.q3c.krail.core.navigate.sitemap.comparator.DefaultUserSitemapSo
  * Round-trip tests for different data types used by Option
  */
 @UseModules([TestOptionJpaModule, DataModule])
-class DefaultOptionJpaDao_LongInt_DataTypeTest extends Specification {
+class DefaultJpaOptionDao__DataTypeTest extends Specification {
 
 
     @Inject

programming_language: Scala
filename: DefaultJpaOptionDao__IntegrationTest.groovy
change_type: ModificationType.RENAME
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.user.opt
@@ -26,7 +28,7 @@ import uk.q3c.krail.i18n.LabelKey
 import uk.q3c.krail.jpa.persist.Jpa1
 
 @UseModules([TestOptionJpaModule, DataModule])
-class DefaultOptionJpaDao_LongInt_IntegrationTest extends Specification {
+class DefaultJpaOptionDao__IntegrationTest extends Specification {
 
     @Inject
     @Jpa1
@@ -80,7 +82,7 @@ class DefaultOptionJpaDao_LongInt_IntegrationTest extends Specification {
         given:
         OptionCacheKey cacheKey = new OptionCacheKey(userHierarchy, RankOption.SPECIFIC_RANK, optionKey);
         when:
-        OptionEntity_LongInt actual = (OptionEntity_LongInt) dao.write(cacheKey, Optional.of("4"));
+        JpaOptionEntity actual = (JpaOptionEntity) dao.write(cacheKey, Optional.of("4"));
         then:
         actual != null
         dao.count() == 1
@@ -92,16 +94,16 @@ class DefaultOptionJpaDao_LongInt_IntegrationTest extends Specification {
         OptionCacheKey cacheKey = new OptionCacheKey(userHierarchy, RankOption.SPECIFIC_RANK, optionKey);
 
         when:
-        OptionEntity_LongInt actual = (OptionEntity_LongInt) dao.write(cacheKey, Optional.of("4"));
-        actual = (OptionEntity_LongInt) dao.write(cacheKey, Optional.of("5"));
-        actual = (OptionEntity_LongInt) dao.write(cacheKey, Optional.of("6"));
-        Optional<OptionEntity_LongInt> result = dao.find(cacheKey)
+        JpaOptionEntity actual = (JpaOptionEntity) dao.write(cacheKey, Optional.of("4"));
+        actual = (JpaOptionEntity) dao.write(cacheKey, Optional.of("5"));
+        actual = (JpaOptionEntity) dao.write(cacheKey, Optional.of("6"));
+        JpaOptionEntity result = dao.find(cacheKey)
 
         then:
         actual != null
         dao.count() == 1
-        result.isPresent()
-        result.get().getValue() == "6"
+        result != null
+        result.getValue() == "6"
 
     }
 
@@ -123,14 +125,14 @@ class DefaultOptionJpaDao_LongInt_IntegrationTest extends Specification {
         when:
 
         dao.deleteValue(cacheKey)
-        Optional<OptionEntity_LongInt> result1 = dao.find(cacheKey1)
-        Optional<OptionEntity_LongInt> result2 = dao.find(cacheKey2)
+        JpaOptionEntity result1 = dao.find(cacheKey1)
+        JpaOptionEntity result2 = dao.find(cacheKey2)
 
         then:
 
         dao.count() == 2
-        result1.get().getValue() == "4"
-        result2.get().getValue() == "5"
+        result1.getValue() == "4"
+        result2.getValue() == "5"
 
     }
 

programming_language: Scala
filename: DefaultOptionJpaDaoTest2.java
change_type: ModificationType.RENAME
diff: @@ -1,12 +1,14 @@
 /*
- * Copyright (c) 2015. David Sowerby
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  * Copyright (c) 2016. David Sowerby
+ *  *
+ *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ *  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ *  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ *  * specific language governing permissions and limitations under the License.
  *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
  */
 
 package uk.q3c.krail.jpa.user.opt;
@@ -35,10 +37,10 @@ import static uk.q3c.krail.core.user.profile.RankOption.*;
 
 @RunWith(MycilaJunitRunner.class)
 @GuiceContext({})
-public class DefaultOptionJpaDaoLongIntTest extends JpaDaoTestBase {
+public class DefaultOptionJpaDaoTest2 extends JpaDaoTestBase {
 
 
-    OptionJpaDao_LongInt dao;
+    JpaOptionDao dao;
 
     @Mock
     UserHierarchy hierarchy1;
@@ -52,7 +54,7 @@ public class DefaultOptionJpaDaoLongIntTest extends JpaDaoTestBase {
     @Before
     public void setup() {
         super.setUp();
-        final Key<OptionJpaDao_LongInt> daoKey = Key.get(OptionJpaDao_LongInt.class, Jpa1.class);
+        final Key<JpaOptionDao> daoKey = Key.get(JpaOptionDao.class, Jpa1.class);
         dao = injector.getInstance(daoKey);
         when(hierarchy1.persistenceName()).thenReturn("p1");
         when(hierarchy1.ranksForCurrentUser()).thenReturn(rankNames1);

programming_language: Java
filename: persistence.xml
change_type: ModificationType.MODIFY
diff: @@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
-  ~ Copyright (c) 2015. David Sowerby
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
-  ~ the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
-  ~ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
-  ~ specific language governing permissions and limitations under the License.
+  ~ /*
+  ~  * Copyright (c) 2016. David Sowerby
+  ~  *
+  ~  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+  ~  * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+  ~  *
+  ~  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+  ~  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+  ~  * specific language governing permissions and limitations under the License.
+  ~  */
   -->
 
 <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -22,8 +24,8 @@
         <class>uk.q3c.krail.jpa.persist.Widget</class>
         <class>uk.q3c.krail.jpa.persist.Widget2</class>
         <class>uk.q3c.krail.jpa.persist.StandardTestEntity</class>
-        <class>uk.q3c.krail.jpa.user.opt.OptionEntity_LongInt</class>
-        <class>uk.q3c.krail.jpa.i18n.PatternEntity_LongInt</class>
+        <class>uk.q3c.krail.jpa.user.opt.JpaOptionEntity</class>
+        <class>uk.q3c.krail.jpa.i18n.JpaPatternEntity</class>
 
         <exclude-unlisted-classes>false</exclude-unlisted-classes>
 
@@ -44,8 +46,8 @@
         <class>uk.q3c.krail.jpa.persist.Widget</class>
         <class>uk.q3c.krail.jpa.persist.Widget2</class>
         <class>uk.q3c.krail.jpa.persist.StandardTestEntity</class>
-        <class>uk.q3c.krail.jpa.user.opt.OptionEntity_LongInt</class>
-        <class>uk.q3c.krail.jpa.i18n.PatternEntity_LongInt</class>
+        <class>uk.q3c.krail.jpa.user.opt.JpaOptionEntity</class>
+        <class>uk.q3c.krail.jpa.i18n.JpaPatternEntity</class>
 
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
 
@@ -66,8 +68,8 @@
         <class>uk.q3c.krail.jpa.persist.Widget</class>
         <class>uk.q3c.krail.jpa.persist.Widget2</class>
         <class>uk.q3c.krail.jpa.persist.StandardTestEntity</class>
-        <class>uk.q3c.krail.jpa.user.opt.OptionEntity_LongInt</class>
-        <class>uk.q3c.krail.jpa.i18n.PatternEntity_LongInt</class>
+        <class>uk.q3c.krail.jpa.user.opt.JpaOptionEntity</class>
+        <class>uk.q3c.krail.jpa.i18n.JpaPatternEntity</class>
 
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
 
@@ -87,8 +89,8 @@
         <class>uk.q3c.krail.jpa.persist.Todo</class>
         <class>uk.q3c.krail.jpa.persist.Widget</class>
         <class>uk.q3c.krail.jpa.persist.Widget2</class>
-        <class>uk.q3c.krail.jpa.user.opt.OptionEntity_LongInt</class>
-        <class>uk.q3c.krail.jpa.i18n.PatternEntity_LongInt</class>
+        <class>uk.q3c.krail.jpa.user.opt.JpaOptionEntity</class>
+        <class>uk.q3c.krail.jpa.i18n.JpaPatternEntity</class>
         <exclude-unlisted-classes>false</exclude-unlisted-classes>
         <properties>
         </properties>

programming_language: Scala