public class GroupFactory extends Factory<Group>
Group JDO
persistent object.
The following code illustrates use of this class and associated JavaBean:
import javax.jdo.PersistenceManager;
import com.sptci.jdo.Group;
import com.sptci.jdo.GroupFactory;
...
GroupFactory factory = GroupFactory().getInstance();
PersistenceManager pm = factory.getPersistenceManager();
try
{
pm.currentTransaction().begin();
String name = "test";
Group group = factory.fetchByName( name, pm );
if ( group != null )
{
group.getDescription();
}
pm.currentTransaction().commit();
}
finally
{
factory.close( pm );
}
© Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
static GroupFactory |
groupFactory
The singleton instance of the DAO.
|
| Constructor and Description |
|---|
GroupFactory() |
| Modifier and Type | Method and Description |
|---|---|
long |
count(javax.jdo.PersistenceManager pm)
Return a count of the total number of persistent instances of the
Group object in the data store. |
Collection<Group> |
fetch(long start,
long end,
javax.jdo.PersistenceManager pm)
Return a collection that contains all
Group instances in the data
store within the specified range. |
Collection<Group> |
fetchAll(javax.jdo.PersistenceManager pm)
Return a collection of all the instances of
Group objects
available in the data store. |
Group |
fetchByName(String name,
javax.jdo.PersistenceManager pm)
Retrieve the
Group uniquely identified by the specified
NameDescription.name field value. |
static GroupFactory |
getInstance()
Return the singleton instance of this class.
|
public static final GroupFactory groupFactory
public static GroupFactory getInstance()
public Group fetchByName(String name, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
Group uniquely identified by the specified
NameDescription.name field value.name - The unique name to use to lookup the object.pm - The persistence manager to use to fetch the object.
It is assumed that an active transaction already exists.null
if no object matching the specified name was found.javax.jdo.JDOException - If errors are encountered while fetching the
record.public long count(javax.jdo.PersistenceManager pm)
throws javax.jdo.JDOException
Group object in the data store.pm - The persistence manager to use to fetch the object count. It
is assumed that an active transaction exists.javax.jdo.JDOException - If errors are encountered while fetching the count.Factory.count( Class, PersistenceManager )public Collection<Group> fetch(long start, long end, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
Group instances in the data
store within the specified range. This method is typically
used to implement paginated view of the data in the data store. Use the
count( PersistenceManager ) method to fetch the total number
of persistent instances in the data store.start - The index (inclusive) from which objects are to be retrieved
from the data store.end - The index (exclusive) till which objects are to be retrieved
from the data store.pm - The persistence manager to use. It is assumed that an
active transaction exists (if non-transaction read is not enabled).javax.jdo.JDOException - If errors are encountered while fetching the
objects.Factory.fetch( Class, long, long, PersistenceManager )public Collection<Group> fetchAll(javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
Group objects
available in the data store.pm - The persistence manager to use to fetch the object.
It is assumed that an active transaction already exists.javax.jdo.JDOException - If errors are encountered while fetching the
object or if no such ObjectId exists.