i find out that we are using 2-unidirectional in lebah.
it mean we need to assign twice unidirectional to make it "look like" bidirectional.
exp: one to many relation
Category has many Item
table:-
category:
id:int
name:string
item:
id:int
name:string
category_id:int
category_item
category_id:int
item_id:int
when assign category to item, category_id save under item table
when add item to category, both id save in join table
to use real bidirectional relational
i saw this in j2ee api:
mappedBy
The field that owns the relationship. Required unless the relationship is unidirectional.
by putting this in Category
@OneToMany(mappedBy="category")
it make Category not create join table and map itself into Item field "category"
becouse relation own by inverses entity, need to ensure it can fetch:
@OneToMany(mappedBy="category", fetch=FecthType.EAGER)
thank to sam told me about implementer, i found this from openjpa:
Java does not provide any native facilities to ensure that both sides of a bidirectional relation remain consistent. Whenever you set one side of the relation, you must manually set the other side as well.
If convenience is more important to you than strict transparency, however, you can enable inverse relation management in OpenJPA.
Java does not provide any native facilities to ensure that both sides of a bidirectional relation remain consistent. Whenever you set one side of the relation, you must manually set the other side as well.
/**
* Paginate Result List
*
* @author Chong Herng Wah
*
*/
public class Paginate {
private List<Entity> resultList;
private int total;
private int pageSize;
private int currentPage;
/**
* Constructors
*
* @param resultList
* Result list
* @param total
* Total result
* @param size
* Result per page
* @param page
* Current page number
*/
public Paginate(List<Entity> resultList, int total, int size, int page) {
this.resultList = resultList;
this.total = total;
this.pageSize = size;
this.currentPage = page;
}
/**
* Get resultList
*
* @return The resultList
*/
public List<Entity> getResultList() {
return resultList;
}
/**
* Get total result
*
* @return The total result
*/
public int getTotal() {
return total;
}
/**
* Get result per page
*
* @return The result per page
*/
public int getPageSize() {
return pageSize;
}
/**
* Get current page number
*
* @return The current page number
*/
public int getCurrentPage() {
return currentPage;
}
/**
* Get previous page number
*
* @return The previous page number
*/
public int getPreviousPage() {
return currentPage - 1;
}
/**
* Get next page number
*
* @return The next page number
*/
public int getNextPage() {
if (isLastPage()) {
return 0;
}
return currentPage + 1;
}
/**
* Check if first page
*
* @return true if first page
*/
public boolean isFirstPage() {
return currentPage == 1;
}
/**
* Check if last page
*
* @return true if last page
*/
public boolean isLastPage() {
return currentPage == getTotalPages();
}
/**
* Get total page number
*
* @return The total page number
*/
public int getTotalPages() {
return (int) Math.ceil((double) total / (double) pageSize);
}
/**
* Start new transaction
*/
public void start() {
em.clear();
tran.begin();
}
/**
* Refresh entities
*/
public void update() {
if (tran.isActive()) {
em.flush();
}
em.refreshAll();
}
/**
* Commit active transaction
*
* @throws Exception
*/
public void end() throws Exception {
if (tran.isActive()) {
tran.commit();
}
}
/**
* Rollback active transaction
*
* @throws Exception
*/
public void rollback() throws Exception {
if (tran.isActive()) {
tran.rollback();
}
}
/**
* Set pageSize
*
* @param pageSize
* The pageSize to set
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
/**
* Get pageSize
*
* @return The pageSize
*/
public int getPageSize() {
return pageSize;
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @return Paginate result list
*/
public Paginate paginate(Class<Entity> c) {
return paginate(c, 1);
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @return Paginate result list
*/
private Paginate paginate(Class<Entity> c, int page) {
return paginate(c, page, this.pageSize);
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @param size
* Result per page
* @return Paginate result list
*/
private Paginate paginate(Class<Entity> c, int page, int size) {
int total = ((Long) em.createQuery(
"SELECT COUNT(c) FROM " + c.getName() + " c").getSingleResult())
.intValue();
OpenJPAQuery query = em.createQuery("SELECT c FROM " + c.getName()
+ " c");
int start = (page - 1) * size;
if (start >= total) {
start = 0;
page = 1;
}
query.setFirstResult(start).setMaxResults(size);
return new Paginate(query.getResultList(), total, size, page);
}
/**
* Pagination
*
* @param q
* Query
* @return Paginate result list
*/
public Paginate paginate(String q) {
return paginate(q, 1);
}
/**
* Pagination
*
* @param q
* Query
* @param page
* Page number
* @return Paginate result list
*/
private Paginate paginate(String q, int page) {
return paginate(q, page, this.pageSize);
}
/**
* Pagiantion
*
* @param q
* Query
* @param page
* Page number
* @param size
* Result per page
* @return Paginate result list
*/
private Paginate paginate(String q, int page, int size) {
OpenJPAQuery query = em.createQuery(q);
int total = query.getResultList().size();
int start = (page - 1) * size;
if (start >= total) {
start = 0;
page = 1;
}
query.setFirstResult(start).setMaxResults(size);
return new Paginate(query.getResultList(), total, size, page);
}
This is from Chong HW
i find out that we are using 2-unidirectional in lebah.
it mean we need to assign twice unidirectional to make it "look like" bidirectional.
exp: one to many relation
Category has many Item
table:-
category:
id:int
name:string
item:
id:int
name:string
category_id:int
category_item
category_id:int
item_id:int
when assign category to item, category_id save under item table
when add item to category, both id save in join table
to use real bidirectional relational
i saw this in j2ee api:
mappedBy
The field that owns the relationship. Required unless the relationship is unidirectional.
by putting this in Category
@OneToMany(mappedBy="category")
it make Category not create join table and map itself into Item field "category"
becouse relation own by inverses entity, need to ensure it can fetch:
@OneToMany(mappedBy="category", fetch=FecthType.EAGER)
thank to sam told me about implementer, i found this from openjpa:
Java does not provide any native facilities to ensure that both sides of a bidirectional relation remain consistent. Whenever you set one side of the relation, you must manually set the other side as well.
If convenience is more important to you than strict transparency, however, you can enable inverse relation management in OpenJPA.
add this to persistence.xml
<property name="openjpa.InverseManager" value="true"/>
to ensure:
@OneToMany(mappedBy="category", fetch=FetchType.EAGER)
@Inverselogical("category")
i was try to test it on one to one and many to many relational
p/s: this will make lebah use "only" openjpa, if there have better implementer, please lat me know before i fully use this method
Regards,
herngwah
From Chong HW
Dear team member,
by default, we list entity class in persistence lists.
each entity created has to write in persistence.xml manually
openjpa metadata factory can load entity automatic,
but, it require empty persistence list
mean, runtime enhancer and mapping not functioning.
ant can run enhancer and mapping tool at build time
but, how about deploy?
persistence list can be jar
is better to use ant to pack entities to jar
1. put all entity source in difference location
2. compile source
3. enhance class
4. pack to jar
5. edit persistence list
ant:
<?xml version="1.0"?>
<project name="openjpa" default="buildJar" basedir="../">
<property file="ant/ant.properties" />
<path id="compile.classpath">
<pathelement location="${lib.dir}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile" depends="clean">
<javac srcdir="${entity.source}" destdir="${entity.build}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="enhance">
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
<classpath refid="compile.classpath"/>
</taskdef>
<openjpac>
<classpath>
<pathelement location="${entity.build}"/>
</classpath>
<config propertiesFile="${persistence.file}"/>
<fileset dir="${entity.source}">
<include name="**/*.java"/>
</fileset>
</openjpac>
</target>
<target name="buildJar" depends="compile,enhance">
<jar destfile="${lib.dir}/${entity.jar}">
<fileset dir="${entity.build}" />
</jar>
</target>
<target name="clean">
<delete dir="${entity.build}" />
<mkdir dir="${entity.build}" />
</target>
</project>
property:
project.distname=lebah
project.distname.shrink=lebah-1.0
webroot.dir=WebContent
webinf.dir=${webroot.dir}/WEB-INF
build.dir=build
lib.dir=${webinf.dir}/lib
entity.jar=${project.distname}-entity.jar
entity.source=LebahEntitySource
entity.build=${build.dir}/entity
persistence.file=${entity.source}/openjpa.xml
persistence:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="persistence">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jar-file>../lib/lebah-entity.jar</jar-file>
<properties>
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/lebah"/>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
<property name="openjpa.ConnectionUserName" value="root"/>
<property name="openjpa.ConnectionPassword" value=""/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
<property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
<property name="openjpa.InverseManager" value="true"/>
</properties>
</persistence-unit>
</persistence>
Regards,
herngwah
Java does not provide any native facilities to ensure that both sides of a bidirectional relation remain consistent. Whenever you set one side of the relation, you must manually set the other side as well.
To solve this, setter have to be rewrite.
package lebah.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
/**
* Entity implementation class for Entity: Category
*
*/
@Entity
public class Category implements Serializable {
private String name;
@OneToOne(mappedBy = "category")
private Item item = null;
private static final long serialVersionUID = 1L;
public Category() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Item getItem() {
return this.item;
}
public void setItem(Item item) {
if (this.item != item) {
if (this.item != null) {
this.item.removeCategory();
}
if (item != null) {
this.item = item;
item.setCategory(this);
}
}
}
public void removeItem() {
if (this.item != null) {
Item tmp = this.item;
this.item = null;
tmp.removeCategory();
}
}
}
package lebah.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
/**
* Entity implementation class for Entity: Item
*
*/
@Entity
public class Item implements Serializable {
private String name;
@OneToOne
private Category category = null;
private static final long serialVersionUID = 1L;
public Item() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Category getCategory() {
return this.category;
}
public void setCategory(Category category) {
if (this.category != category) {
if (this.category != null) {
this.category.removeItem();
}
if (category != null) {
this.category = category;
category.setItem(this);
}
}
}
public void removeCategory() {
if (this.category != null) {
Category tmp = this.category;
this.category = null;
tmp.removeItem();
}
}
}
<pre>
package lebah.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
/**
* Entity implementation class for Entity: Category
*
*/
@Entity
public class Category implements Serializable {
private String name;
@OneToMany(mappedBy = "category")
private Collection<Item> items = new ArrayList<Item>();
private static final long serialVersionUID = 1L;
public Category() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Collection<Item> getItems() {
return this.items;
}
public void setItems(Collection<Item> items) {
this.removeItems();
for (Item i : items) {
addItem(i);
}
}
public void addItem(Item item) {
if (!this.items.contains(item)) {
this.items.add(item);
item.setCategory(this);
}
}
public void removeItems() {
for (Item i : new ArrayList<Item>(this.items)) {
removeItem(i);
}
}
public void removeItem(Item item) {
if (this.items.contains(item)) {
this.items.remove(item);
item.removeCategory();
}
}
}
</pre>
<pre>
package lebah.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
/**
* Entity implementation class for Entity: Item
*
*/
@Entity
public class Item implements Serializable {
private String name;
@ManyToOne
private Category category = null;
private static final long serialVersionUID = 1L;
public Item() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Category getCategory() {
return this.category;
}
public void setCategory(Category category) {
if (this.category != category) {
if (this.category != null) {
removeCategory();
}
if (category != null) {
this.category = category;
category.addItem(this);
}
}
}
public void removeCategory() {
if (this.category != null) {
Category tmp = this.category;
this.category = null;
tmp.removeItem(this);
}
}
}
</pre>
package lebah.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
/**
* Entity implementation class for Entity: Category
*
*/
@Entity
public class Category implements Serializable {
private String name;
@ManyToMany(mappedBy = "categories")
private Collection<Item> items = new ArrayList<Item>();
private static final long serialVersionUID = 1L;
public Category() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Collection<Item> getItems() {
return this.items;
}
public void setItems(Collection<Item> items) {
this.removeItems();
for (Item i : items) {
addItem(i);
}
}
public void addItem(Item item) {
if (!this.items.contains(item)) {
this.items.add(item);
item.addCategory(this);
}
}
public void removeItems() {
for (Item i : new ArrayList<Item>(this.items)) {
removeItem(i);
}
}
public void removeItem(Item item) {
if (this.items.contains(item)) {
this.items.remove(item);
item.removeCategory(this);
}
}
}
package lebah.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
/**
* Entity implementation class for Entity: Item
*
*/
@Entity
public class Item implements Serializable {
private String name;
@ManyToMany
private Collection<Category> categories = new ArrayList<Category>();
private static final long serialVersionUID = 1L;
public Item() {
super();
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Collection<Category> getCategories() {
return this.categories;
}
public void setCategories(Collection<Category> categories) {
removeCategories();
for (Category category : categories) {
addCategory(category);
}
}
public void removeCategories() {
for (Category c : new ArrayList<Category>(categories)) {
removeCategory(c);
}
}
public void addCategory(Category category) {
if (!this.categories.contains(category)) {
this.categories.add(category);
category.addItem(this);
}
}
public void removeCategory(Category category) {
if (this.categories.contains(category)) {
this.categories.remove(category);
category.removeItem(this);
}
}
}
/*
* $Id$
*/
package lebah.db;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import javax.persistence.Entity;
/**
* Paginate Result List
*
* @author Chong Herng Wah
*
*/
public class Paginate {
private List<Entity> resultList;
private int total;
private int pageSize;
private int currentPage;
/**
* Constructors
*
* @param resultList
* Result list
* @param total
* Total result
* @param size
* Result per page
* @param page
* Current page number
*/
public Paginate(List<Entity> resultList, int total, int size, int page) {
this.resultList = resultList;
this.total = total;
this.pageSize = size;
this.currentPage = page;
}
/**
* Get resultList
*
* @return The resultList
*/
public List<Entity> getResultList() {
return resultList;
}
/**
* Get total result
*
* @return The total result
*/
public int getTotal() {
return total;
}
/**
* Get result per page
*
* @return The result per page
*/
public int getPageSize() {
return pageSize;
}
/**
* Get current page number
*
* @return The current page number
*/
public int getCurrentPage() {
return currentPage;
}
/**
* Get previous page number
*
* @return The previous page number
*/
public int getPreviousPage() {
return currentPage - 1;
}
/**
* Get next page number
*
* @return The next page number
*/
public int getNextPage() {
if (isLastPage()) {
return 0;
}
return currentPage + 1;
}
/**
* Check if first page
*
* @return true if first page
*/
public boolean isFirstPage() {
return currentPage == 1;
}
/**
* Check if last page
*
* @return true if last page
*/
public boolean isLastPage() {
return currentPage == getTotalPages();
}
/**
* Get total page number
*
* @return The total page number
*/
public int getTotalPages() {
return (int) Math.ceil((double) total / (double) pageSize);
}
/*
* (non-Javadoc)
*
* @see java.util.List#get(int)
*/
public Object get(int index) {
return resultList.get(index);
}
/*
* (non-Javadoc)
*
* @see java.util.List#isEmpty()
*/
public boolean isEmpty() {
return resultList.isEmpty();
}
/*
* (non-Javadoc)
*
* @see java.util.List#iterator()
*/
public Iterator<Entity> iterator() {
return resultList.iterator();
}
/*
* (non-Javadoc)
*
* @see java.util.List#listIterator()
*/
public ListIterator<Entity> listIterator() {
return resultList.listIterator();
}
/*
* (non-Javadoc)
*
* @see java.util.List#listIterator(int)
*/
public ListIterator<Entity> listIterator(int index) {
return resultList.listIterator(index);
}
/*
* (non-Javadoc)
*
* @see java.util.List#size()
*/
public int size() {
return resultList.size();
}
/*
* (non-Javadoc)
*
* @see java.util.List#toArray()
*/
public Object[] toArray() {
return resultList.toArray();
}
/*
* (non-Javadoc)
*
* @see java.util.List#toArray(T[])
*/
public <T> T[] toArray(T[] a) {
return resultList.toArray(a);
}
}
package lebah.db;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.Persistence;
import javax.persistence.Query;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.openjpa.persistence.OpenJPAQuery;
/**
* @author Shamsul Bahrin Abd Mutalib
* @version 1.1
*/
public class PersistenceManager implements EntityManager {
private static OpenJPAEntityManager em;
private static EntityTransaction tran;
private int pageSize = 10;
static {
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("persistence");
em = (OpenJPAEntityManager) emf.createEntityManager();
tran = em.getTransaction();
}
/**
* Start new transaction
*/
public void start() {
em.clear();
tran.begin();
}
/**
* Refresh entities
*/
public void update() {
if (tran.isActive()) {
em.flush();
}
em.refreshAll();
}
/**
* Commit active transaction
*
* @throws Exception
*/
public void end() throws Exception {
if (tran.isActive()) {
tran.commit();
}
}
/**
* Rollback active transaction
*
* @throws Exception
*/
public void rollback() throws Exception {
if (tran.isActive()) {
tran.rollback();
}
}
/**
* Set pageSize
*
* @param pageSize
* The pageSize to set
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
/**
* Get pageSize
*
* @return The pageSize
*/
public int getPageSize() {
return pageSize;
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @return Paginate result list
*/
public Paginate paginate(Class<Entity> c) {
return paginate(c, 1);
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @return Paginate result list
*/
private Paginate paginate(Class<Entity> c, int page) {
return paginate(c, page, this.pageSize);
}
/**
* Pagination
*
* @param c
* Class name
* @param page
* Page number
* @param size
* Result per page
* @return Paginate result list
*/
private Paginate paginate(Class<Entity> c, int page, int size) {
int total = ((Long) em.createQuery(
"SELECT COUNT(c) FROM " + c.getName() + " c").getSingleResult())
.intValue();
OpenJPAQuery query = em.createQuery("SELECT c FROM " + c.getName()
+ " c");
int start = (page - 1) * size;
if (start >= total) {
start = 0;
page = 1;
}
query.setFirstResult(start).setMaxResults(size);
return new Paginate(query.getResultList(), total, size, page);
}
/**
* Pagination
*
* @param q
* Query
* @return Paginate result list
*/
public Paginate paginate(String q) {
return paginate(q, 1);
}
/**
* Pagination
*
* @param q
* Query
* @param page
* Page number
* @return Paginate result list
*/
private Paginate paginate(String q, int page) {
return paginate(q, page, this.pageSize);
}
/**
* Pagiantion
*
* @param q
* Query
* @param page
* Page number
* @param size
* Result per page
* @return Paginate result list
*/
private Paginate paginate(String q, int page, int size) {
OpenJPAQuery query = em.createQuery(q);
int total = query.getResultList().size();
int start = (page - 1) * size;
if (start >= total) {
start = 0;
page = 1;
}
query.setFirstResult(start).setMaxResults(size);
return new Paginate(query.getResultList(), total, size, page);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#clear()
*/
public void clear() {
em.clear();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#close()
*/
public void close() {
em.close();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#contains(java.lang.Object)
*/
public boolean contains(Object arg0) {
return em.contains(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#createNamedQuery(java.lang.String)
*/
public Query createNamedQuery(String arg0) {
return em.createNamedQuery(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#createNativeQuery(java.lang.String)
*/
public Query createNativeQuery(String arg0) {
return em.createNativeQuery(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#createNativeQuery(java.lang.String,
* java.lang.Class)
*/
public Query createNativeQuery(String arg0, Class arg1) {
return em.createNativeQuery(arg0, arg1);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#createNativeQuery(java.lang.String,
* java.lang.String)
*/
public Query createNativeQuery(String arg0, String arg1) {
return em.createNativeQuery(arg0, arg1);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#createQuery(java.lang.String)
*/
public Query createQuery(String arg0) {
return em.createQuery(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#find(java.lang.Class,
* java.lang.Object)
*/
public <T> T find(Class<T> arg0, Object arg1) {
return em.find(arg0, arg1);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#flush()
*/
public void flush() {
em.flush();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#getDelegate()
*/
public Object getDelegate() {
return em.getDelegate();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#getFlushMode()
*/
public FlushModeType getFlushMode() {
return em.getFlushMode();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#getReference(java.lang.Class,
* java.lang.Object)
*/
public <T> T getReference(Class<T> arg0, Object arg1) {
return em.getReference(arg0, arg1);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#getTransaction()
*/
public EntityTransaction getTransaction() {
return em.getTransaction();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#isOpen()
*/
public boolean isOpen() {
return em.isOpen();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#joinTransaction()
*/
public void joinTransaction() {
em.joinTransaction();
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#lock(java.lang.Object,
* javax.persistence.LockModeType)
*/
public void lock(Object arg0, LockModeType arg1) {
em.lock(arg0, arg1);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#merge(java.lang.Object)
*/
public <T> T merge(T arg0) {
return em.merge(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#persist(java.lang.Object)
*/
public void persist(Object arg0) {
em.persist(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#refresh(java.lang.Object)
*/
public void refresh(Object arg0) {
em.refresh(arg0);
}
/*
* (non-Javadoc)
*
* @see javax.persistence.EntityManager#remove(java.lang.Object)
*/
public void remove(Object arg0) {
em.remove(arg0);
}
/*
* (non-Javadoc)
*
* @see
* javax.persistence.EntityManager#setFlushMode(javax.persistence.FlushModeType
* )
*/
public void setFlushMode(FlushModeType arg0) {
em.setFlushMode(arg0);
}
/*
* (non-Javadoc)
*
* @see
* org.apache.openjpa.persistence.OpenJPAEntityManager#persistAll(java.lang
* .Object[])
*/
public void persistAll(Object... arg0) {
em.persistAll(arg0);
}
/*
* (non-Javadoc)
*
* @see org.apache.openjpa.persistence.OpenJPAEntityManager#refreshAll()
*/
public void refreshAll() {
em.refreshAll();
}
}