You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Armin Waibel <ar...@code-au-lait.de> on 2004/01/20 22:01:22 UTC

[1.1 Proposal] Introduce an IdentityFactory

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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Brian McCallister <mc...@forthillcompany.com>.
+1 Much needed feature

-Brian

On Jan 20, 2004, at 4:01 PM, 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
>
>



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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
+1

Best Regards,

Antonio Gallardo

Armin Waibel dijo:
> 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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Jakob Bräuchi <jb...@gmx.ch>.
+1

jakob

> 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
> 

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail


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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
+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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Thomas,

Thomas Mahler wrote:
> Hi Armin,
> 
> +1
> 
> Of course this is a much needed feature. why did we never think of it 
> before?

Because we are focused on development of OJB, not usage ;-)

> I'd also love to have a replacement for
> Identity oid = new Identity(obj,broker);
> 
> maybe something like:
> Identity oid = broker.serviceIdentityFactory.buildIdentity(obj);
> 
> This would help users working with example objects.
> 

This method is scheduled. First draft of the interface see below

 >> 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);
 >> }
 >>

regards,
Armin

> have a nice weekend,
> 
> Thomas
> 
> 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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



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


Re: [1.1 Proposal] Introduce an IdentityFactory

Posted by Thomas Mahler <th...@web.de>.
Hi Armin,

+1

Of course this is a much needed feature. why did we never think of it 
before?
I'd also love to have a replacement for
Identity oid = new Identity(obj,broker);

maybe something like:
Identity oid = broker.serviceIdentityFactory.buildIdentity(obj);

This would help users working with example objects.

have a nice weekend,

Thomas

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
> 
> 


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