db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Rodrigo Saad Cruz <lean...@ibnetwork.com.br>
Subject Re: [1.1 Proposal] Introduce an IdentityFactory
Date Tue, 20 Jan 2004 23:51:36 GMT
+1 

On Tue, 2004-01-20 at 19:01, Armin Waibel wrote:
> Hi all,
> 
> I propose to introduce an IdentityFactory class by a service method in 
> PB (think some users made a similar proposal in the past):
> 
> PB.serviceIdentityFactory
> 
> IdentityFactory will simplify the creation of Identity objects and will 
> make find by primary key much easier.
> 
> Currently user have to create a Identity object on its own and do
> (assume we use a single PK per class)
> 
> Object[] pkValueArray = new Object[]{new Integer(4711)};
> Class topLevelClass = broker.getTopLevelClass(realClass);
> Identity oid = new Identity(realClass, topLevelClass, pkValueArray)
> Object result = broker.getObjectByIdentity(Identity oid)
> 
> The creation of the Identity object is a mess!
> With the new service class same example look like
> 
> Identity oid = broker.serviceIdentityFactory.buildIdentity(realClass, 
> new Integer(4711));
> Object result = broker.getObjectByIdentity(Identity oid)
> 
> Any comments?
> 
> regards,
> Armin
> 
> public interface IdentityFactory
> {
>      Identity buildIdentity(Object obj);
> 
>      Identity buildIdentity(ClassDescriptor cld, Object obj);
> 
>      Identity buildIdentity(Class realClass, Class topLevelClass, 
> String[] pkFieldName, Object[] pkValues);
> 
>      Identity buildIdentity(Class realClass, String[] fieldName, 
> Object[] pkValues);
> 
>      Identity buildIdentity(Class realClass, Object pkValue);
> }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sourceforge.net



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message