You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2004/03/29 16:12:07 UTC

1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)

Still with problems when using a 1:0..1 mapping + proxy="dynamic".
The problem is:

when making a reference between two objects (X:Y) and there can be 0 or 
1 object in Y side, Y must resturn NULL if it don't exists in database, 
and the object itself if there is 1 object in database. The rule is 
maintained using same PK for two tables, a foreign key to guarantee data 
integrity, and a NULL allowed in the X side to allow 0 values in Y side.

the error is seen when using "proxy='dynamic'" because OJB set, 
internally, the value to a dynamic proxy. In the code, when you test 
"myXobject.getY()==null" the result is always false, because getY is 
returnin a non-materialized proxy. The following code will always throw 
NPE when are 0 Y objects for a X object (but if proxy="false", there is 
no error):

if(myXobject.getY()!=null) {
  // It always get into here, even when there is no Y value!!!
  System.out.println(myXobject.getY().getId());
  // the previous line will throw NPE, because when acessisng getId(), 
OJB will try to materialize,
  // since there is no Y object, will try to execute getId() over a null 
materialized.
}

This sayid, I think OJB should execute a count when using a reference as 
proxy, and when there is 0 object, return null, not a unmaterialized 
proxy (so the null test in code above will have same behaviour as if 
it's not proxy).

What you say?

Best regards,

Edson Richter


Best regards,

Edson Richter


Armin Waibel wrote:

> Hi Edson,
>
> edson.richter@mgrinformatica.com.br wrote:
>
>> Hmmm, what about the "1:0..1 and proxies test for null is always 
>> false" and the "afterStore
>> not being called for collections"? Are they fixed too?
>>
>
> Sorry I don't know. While refactoring the handling of the auto-xxx 
> code I do my best, but I don't turn my attention to these problems.
> Could you review/test the rc6/CVS code and repost the problematic spots?
>
> regards,
> Armin
>
>>
>> Best regards,
>>
>> Edson Richter
>>
>>
>>
>>> Dear all,
>>>
>>> We've got a new release! Given we find no showstoppers during the next
>>> week we will approach the Project Management Committee (PMC) of the
>>> db.apache.org project to get approval to relabel this release as the
>>> final 1.0 version.
>>>
>>> Armin worked hard to get our regression testbed rocksolid. We now have
>>> more than 600 testcases covering all major areas of the framework!
>>> I'm confident that this testsuite will help us to maintain and even
>>> increse the reliability of our code from release to release.
>>>
>>> Thanks to all who helped and contributed to this release!
>>>
>>> --Thomas
>>>
>>>
>>> From the release notes:
>>>
>>> ---------------------------------------------------------------------
>>> Release 1.0 rc6
>>> ---------------------------------------------------------------------
>>>
>>> NEW FEATURES:
>>>  -
>>>
>>> NOTES:
>>> - Repository.dtd has changed, don't forget to replace this file
>>> - Upgraded to the new Apache License, Version 2.0
>>> - No support for HSQLDB 1.7.2RC1 yet
>>> - No support for Torque 3.1 yet
>>>
>>> - Add new PersistenceBrokerFactory implementation for use in managed
>>> environments when *only* the
>>> PB-api was used and participation in JTA transaction via 
>>> Synchronization
>>> interface is needed.
>>>
>>> - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl.
>>> Used to enable a simple
>>> synchronization mechanism to keep cache in sync with DB
>>>
>>> - Add new attribute values for reference-/collection-descriptor
>>> auto-update/-delete attribute.
>>> Now we have five possible values: none, link, object, true, false. The
>>> true, false values
>>> are now deprecated but will NOT be removed in near future (so don't 
>>> panic!).
>>>
>>> CHANGES:
>>> - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was
>>> INTEGER but
>>> needs BIGINT to support Long on java side
>>>
>>> - no longer throw an exception when calling abortTransaction more than
>>> one time
>>> or an internal rollback (by ConnectionManager on the used connection)
>>> was already done
>>>
>>> - Add object-cache tag in standard jdbc-connection-descriptor in
>>> repository_database.xml
>>> to enable new 'autoSync' property of ObjectCacheDefaultImpl for all
>>> operations made by
>>> this DB connection
>>>
>>> - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl
>>> (handle with care ;-))
>>>
>>> - odmg-api implementation, disable restore of transient objects on
>>> transaction abort,
>>> because we can't really restore the whole object with all references
>>>
>>> - now using ANTLR 2.7.2 and Unicode support in OQL queries
>>> - now using ANT 1.6.0
>>>
>>> - RelationshipPrefetcher no longer modifies auto-retrieve setting of
>>> Relationship-Descriptor.
>>> This may result in additional sql-queries but is safer in a
>>> multi-threaded environment.
>>>
>>> - Added column methods to Criteria. addColumnEqualTo, addColumnIn etc.
>>> The column parameter
>>> of these methods will not be translated during sql-generation. These
>>> methods are mainly used
>>> for internal purpose.
>>>
>>> BUG FIXES:
>>>
>>> Please refer to our Bug tracking site
>>> (http://issues.apache.org/scarab/servlet/scarab/)
>>> under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx
>>> to see details for a bug with id OJBxxx.
>>>
>>> - fix bug in MetadataManager, when 'per thread changes' is enabled and
>>> many different
>>> DescriptorRepository instances were used, gc can't collect unused
>>> instances because
>>> StatementManager doesn't release references to used 
>>> DescriptorRepository
>>> instances.
>>>
>>> - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use a 
>>> soft
>>> reference
>>> for the object wrapper of the cached object. Use a softreference for 
>>> the
>>> cached
>>> object instead
>>>
>>> - fix bug in CacheDistributor (internal used ObjectCache
>>> implementation), each CacheDistributor
>>> instance have to held ObjectCache instances for the associated
>>> PersistenceBroker instance
>>>
>>> - fix documentation bug in ObjectCacheDefaultImpl, property 
>>> 'timeout' use
>>> seconds instead of milliseconds
>>>
>>> - fix bug in new DList implementation (DListImpl_2), materialization of
>>> objects
>>> failed when DList instance itself was persisted (using db.bind(...)) 
>>> and
>>> re-loaded within tx, but iteration over the list values was done 
>>> outside
>>> of the tx
>>>
>>> - The bogus ODMG Distributed Lockmanagement feature has been 
>>> replaced by
>>> a new
>>>   Servlet based LockServer. Transaction isolation should now work
>>> properly even
>>>   accross a cluster of JVMs.
>>>
>>> - fix bug in MtoNCollectionPrefetcher, multi-key handling is now 
>>> supported.
>>>
>>> - ClassCastException with ManageableCollection implementations on m:n
>>> relation.
>>> m:n relation now can handle ManageableCollection collection classes 
>>> in a
>>> correct way,
>>> the collection class no longer needs to implement java.util.Collection.
>>>
>>> KNOWN ISSUES:
>>> - odmg-api: It is not possible to exchange objects in 1:n references.
>>> E.g. two objects with 1:n reference, each with one reference object,
>>> obj_1{ref_1}
>>> and obj_2{ref_2}. Lock objects and exchange the references in 
>>> collection
>>> obj_1{ref_2}
>>> and obj_2{ref_1} and commit.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>



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


Re: 1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi edson,

maybe we have just discovered another configurable feature of ojb.
check-existence-of-proxy = 'true' on the relationship-definition.

jakob

Edson Carlos Ericksson Richter wrote:

> An un-elegant way to do same withou select count:
> 
> try {
>  String x = myXobject.getY().toString();
> } catch(NullPointerException e) {
>  ... do something because there is no Y...
> }
> 
> The question is: what cost more? Doing a select count(*) over a indexed 
> (primary key) field, with all network overhead, or catching a NPE?
> 
> 
> Best regards,
> 
> Edson Richter
> 
> 
> Jakob Braeuchi wrote:
> 
>> hi edson,
>>
>> executing an additional count on each reference proxy is quite 
>> expensive. but i have to admit, i do not have a better solution right 
>> now :(
>>
>> jakob
>>
>> Edson Carlos Ericksson Richter wrote:
>>
>>> Still with problems when using a 1:0..1 mapping + proxy="dynamic".
>>> The problem is:
>>>
>>> when making a reference between two objects (X:Y) and there can be 0 
>>> or 1 object in Y side, Y must resturn NULL if it don't exists in 
>>> database, and the object itself if there is 1 object in database. The 
>>> rule is maintained using same PK for two tables, a foreign key to 
>>> guarantee data integrity, and a NULL allowed in the X side to allow 0 
>>> values in Y side.
>>>
>>> the error is seen when using "proxy='dynamic'" because OJB set, 
>>> internally, the value to a dynamic proxy. In the code, when you test 
>>> "myXobject.getY()==null" the result is always false, because getY is 
>>> returnin a non-materialized proxy. The following code will always 
>>> throw NPE when are 0 Y objects for a X object (but if proxy="false", 
>>> there is no error):
>>>
>>> if(myXobject.getY()!=null) {
>>>  // It always get into here, even when there is no Y value!!!
>>>  System.out.println(myXobject.getY().getId());
>>>  // the previous line will throw NPE, because when acessisng getId(), 
>>> OJB will try to materialize,
>>>  // since there is no Y object, will try to execute getId() over a 
>>> null materialized.
>>> }
>>>
>>> This sayid, I think OJB should execute a count when using a reference 
>>> as proxy, and when there is 0 object, return null, not a 
>>> unmaterialized proxy (so the null test in code above will have same 
>>> behaviour as if it's not proxy).
>>>
>>> What you say?
>>>
>>> Best regards,
>>>
>>> Edson Richter
>>>
>>>
>>> Best regards,
>>>
>>> Edson Richter
>>>
>>>
>>> Armin Waibel wrote:
>>>
>>>> Hi Edson,
>>>>
>>>> edson.richter@mgrinformatica.com.br wrote:
>>>>
>>>>> Hmmm, what about the "1:0..1 and proxies test for null is always 
>>>>> false" and the "afterStore
>>>>> not being called for collections"? Are they fixed too?
>>>>>
>>>>
>>>> Sorry I don't know. While refactoring the handling of the auto-xxx 
>>>> code I do my best, but I don't turn my attention to these problems.
>>>> Could you review/test the rc6/CVS code and repost the problematic 
>>>> spots?
>>>>
>>>> regards,
>>>> Armin
>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Edson Richter
>>>>>
>>>>>
>>>>>
>>>>>> Dear all,
>>>>>>
>>>>>> We've got a new release! Given we find no showstoppers during the 
>>>>>> next
>>>>>> week we will approach the Project Management Committee (PMC) of the
>>>>>> db.apache.org project to get approval to relabel this release as the
>>>>>> final 1.0 version.
>>>>>>
>>>>>> Armin worked hard to get our regression testbed rocksolid. We now 
>>>>>> have
>>>>>> more than 600 testcases covering all major areas of the framework!
>>>>>> I'm confident that this testsuite will help us to maintain and even
>>>>>> increse the reliability of our code from release to release.
>>>>>>
>>>>>> Thanks to all who helped and contributed to this release!
>>>>>>
>>>>>> --Thomas
>>>>>>
>>>>>>
>>>>>> From the release notes:
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> Release 1.0 rc6
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> NEW FEATURES:
>>>>>>  -
>>>>>>
>>>>>> NOTES:
>>>>>> - Repository.dtd has changed, don't forget to replace this file
>>>>>> - Upgraded to the new Apache License, Version 2.0
>>>>>> - No support for HSQLDB 1.7.2RC1 yet
>>>>>> - No support for Torque 3.1 yet
>>>>>>
>>>>>> - Add new PersistenceBrokerFactory implementation for use in managed
>>>>>> environments when *only* the
>>>>>> PB-api was used and participation in JTA transaction via 
>>>>>> Synchronization
>>>>>> interface is needed.
>>>>>>
>>>>>> - Add new configuration property 'autoSync' to 
>>>>>> ObjectCacheDefaultImpl.
>>>>>> Used to enable a simple
>>>>>> synchronization mechanism to keep cache in sync with DB
>>>>>>
>>>>>> - Add new attribute values for reference-/collection-descriptor
>>>>>> auto-update/-delete attribute.
>>>>>> Now we have five possible values: none, link, object, true, false. 
>>>>>> The
>>>>>> true, false values
>>>>>> are now deprecated but will NOT be removed in near future (so 
>>>>>> don't panic!).
>>>>>>
>>>>>> CHANGES:
>>>>>> - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was
>>>>>> INTEGER but
>>>>>> needs BIGINT to support Long on java side
>>>>>>
>>>>>> - no longer throw an exception when calling abortTransaction more 
>>>>>> than
>>>>>> one time
>>>>>> or an internal rollback (by ConnectionManager on the used connection)
>>>>>> was already done
>>>>>>
>>>>>> - Add object-cache tag in standard jdbc-connection-descriptor in
>>>>>> repository_database.xml
>>>>>> to enable new 'autoSync' property of ObjectCacheDefaultImpl for all
>>>>>> operations made by
>>>>>> this DB connection
>>>>>>
>>>>>> - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl
>>>>>> (handle with care ;-))
>>>>>>
>>>>>> - odmg-api implementation, disable restore of transient objects on
>>>>>> transaction abort,
>>>>>> because we can't really restore the whole object with all references
>>>>>>
>>>>>> - now using ANTLR 2.7.2 and Unicode support in OQL queries
>>>>>> - now using ANT 1.6.0
>>>>>>
>>>>>> - RelationshipPrefetcher no longer modifies auto-retrieve setting of
>>>>>> Relationship-Descriptor.
>>>>>> This may result in additional sql-queries but is safer in a
>>>>>> multi-threaded environment.
>>>>>>
>>>>>> - Added column methods to Criteria. addColumnEqualTo, addColumnIn 
>>>>>> etc.
>>>>>> The column parameter
>>>>>> of these methods will not be translated during sql-generation. These
>>>>>> methods are mainly used
>>>>>> for internal purpose.
>>>>>>
>>>>>> BUG FIXES:
>>>>>>
>>>>>> Please refer to our Bug tracking site
>>>>>> (http://issues.apache.org/scarab/servlet/scarab/)
>>>>>> under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx
>>>>>> to see details for a bug with id OJBxxx.
>>>>>>
>>>>>> - fix bug in MetadataManager, when 'per thread changes' is enabled 
>>>>>> and
>>>>>> many different
>>>>>> DescriptorRepository instances were used, gc can't collect unused
>>>>>> instances because
>>>>>> StatementManager doesn't release references to used 
>>>>>> DescriptorRepository
>>>>>> instances.
>>>>>>
>>>>>> - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use 
>>>>>> a soft
>>>>>> reference
>>>>>> for the object wrapper of the cached object. Use a softreference 
>>>>>> for the
>>>>>> cached
>>>>>> object instead
>>>>>>
>>>>>> - fix bug in CacheDistributor (internal used ObjectCache
>>>>>> implementation), each CacheDistributor
>>>>>> instance have to held ObjectCache instances for the associated
>>>>>> PersistenceBroker instance
>>>>>>
>>>>>> - fix documentation bug in ObjectCacheDefaultImpl, property 
>>>>>> 'timeout' use
>>>>>> seconds instead of milliseconds
>>>>>>
>>>>>> - fix bug in new DList implementation (DListImpl_2), 
>>>>>> materialization of
>>>>>> objects
>>>>>> failed when DList instance itself was persisted (using 
>>>>>> db.bind(...)) and
>>>>>> re-loaded within tx, but iteration over the list values was done 
>>>>>> outside
>>>>>> of the tx
>>>>>>
>>>>>> - The bogus ODMG Distributed Lockmanagement feature has been 
>>>>>> replaced by
>>>>>> a new
>>>>>>   Servlet based LockServer. Transaction isolation should now work
>>>>>> properly even
>>>>>>   accross a cluster of JVMs.
>>>>>>
>>>>>> - fix bug in MtoNCollectionPrefetcher, multi-key handling is now 
>>>>>> supported.
>>>>>>
>>>>>> - ClassCastException with ManageableCollection implementations on m:n
>>>>>> relation.
>>>>>> m:n relation now can handle ManageableCollection collection 
>>>>>> classes in a
>>>>>> correct way,
>>>>>> the collection class no longer needs to implement 
>>>>>> java.util.Collection.
>>>>>>
>>>>>> KNOWN ISSUES:
>>>>>> - odmg-api: It is not possible to exchange objects in 1:n references.
>>>>>> E.g. two objects with 1:n reference, each with one reference object,
>>>>>> obj_1{ref_1}
>>>>>> and obj_2{ref_2}. Lock objects and exchange the references in 
>>>>>> collection
>>>>>> obj_1{ref_2}
>>>>>> and obj_2{ref_1} and commit.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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


Re: 1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
An un-elegant way to do same withou select count:

try {
  String x = myXobject.getY().toString();
} catch(NullPointerException e) {
  ... do something because there is no Y...
}

The question is: what cost more? Doing a select count(*) over a indexed 
(primary key) field, with all network overhead, or catching a NPE?


Best regards,

Edson Richter


Jakob Braeuchi wrote:

> hi edson,
>
> executing an additional count on each reference proxy is quite 
> expensive. but i have to admit, i do not have a better solution right 
> now :(
>
> jakob
>
> Edson Carlos Ericksson Richter wrote:
>
>> Still with problems when using a 1:0..1 mapping + proxy="dynamic".
>> The problem is:
>>
>> when making a reference between two objects (X:Y) and there can be 0 
>> or 1 object in Y side, Y must resturn NULL if it don't exists in 
>> database, and the object itself if there is 1 object in database. The 
>> rule is maintained using same PK for two tables, a foreign key to 
>> guarantee data integrity, and a NULL allowed in the X side to allow 0 
>> values in Y side.
>>
>> the error is seen when using "proxy='dynamic'" because OJB set, 
>> internally, the value to a dynamic proxy. In the code, when you test 
>> "myXobject.getY()==null" the result is always false, because getY is 
>> returnin a non-materialized proxy. The following code will always 
>> throw NPE when are 0 Y objects for a X object (but if proxy="false", 
>> there is no error):
>>
>> if(myXobject.getY()!=null) {
>>  // It always get into here, even when there is no Y value!!!
>>  System.out.println(myXobject.getY().getId());
>>  // the previous line will throw NPE, because when acessisng getId(), 
>> OJB will try to materialize,
>>  // since there is no Y object, will try to execute getId() over a 
>> null materialized.
>> }
>>
>> This sayid, I think OJB should execute a count when using a reference 
>> as proxy, and when there is 0 object, return null, not a 
>> unmaterialized proxy (so the null test in code above will have same 
>> behaviour as if it's not proxy).
>>
>> What you say?
>>
>> Best regards,
>>
>> Edson Richter
>>
>>
>> Best regards,
>>
>> Edson Richter
>>
>>
>> Armin Waibel wrote:
>>
>>> Hi Edson,
>>>
>>> edson.richter@mgrinformatica.com.br wrote:
>>>
>>>> Hmmm, what about the "1:0..1 and proxies test for null is always 
>>>> false" and the "afterStore
>>>> not being called for collections"? Are they fixed too?
>>>>
>>>
>>> Sorry I don't know. While refactoring the handling of the auto-xxx 
>>> code I do my best, but I don't turn my attention to these problems.
>>> Could you review/test the rc6/CVS code and repost the problematic 
>>> spots?
>>>
>>> regards,
>>> Armin
>>>
>>>>
>>>> Best regards,
>>>>
>>>> Edson Richter
>>>>
>>>>
>>>>
>>>>> Dear all,
>>>>>
>>>>> We've got a new release! Given we find no showstoppers during the 
>>>>> next
>>>>> week we will approach the Project Management Committee (PMC) of the
>>>>> db.apache.org project to get approval to relabel this release as the
>>>>> final 1.0 version.
>>>>>
>>>>> Armin worked hard to get our regression testbed rocksolid. We now 
>>>>> have
>>>>> more than 600 testcases covering all major areas of the framework!
>>>>> I'm confident that this testsuite will help us to maintain and even
>>>>> increse the reliability of our code from release to release.
>>>>>
>>>>> Thanks to all who helped and contributed to this release!
>>>>>
>>>>> --Thomas
>>>>>
>>>>>
>>>>> From the release notes:
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> Release 1.0 rc6
>>>>> ---------------------------------------------------------------------
>>>>>
>>>>> NEW FEATURES:
>>>>>  -
>>>>>
>>>>> NOTES:
>>>>> - Repository.dtd has changed, don't forget to replace this file
>>>>> - Upgraded to the new Apache License, Version 2.0
>>>>> - No support for HSQLDB 1.7.2RC1 yet
>>>>> - No support for Torque 3.1 yet
>>>>>
>>>>> - Add new PersistenceBrokerFactory implementation for use in managed
>>>>> environments when *only* the
>>>>> PB-api was used and participation in JTA transaction via 
>>>>> Synchronization
>>>>> interface is needed.
>>>>>
>>>>> - Add new configuration property 'autoSync' to 
>>>>> ObjectCacheDefaultImpl.
>>>>> Used to enable a simple
>>>>> synchronization mechanism to keep cache in sync with DB
>>>>>
>>>>> - Add new attribute values for reference-/collection-descriptor
>>>>> auto-update/-delete attribute.
>>>>> Now we have five possible values: none, link, object, true, false. 
>>>>> The
>>>>> true, false values
>>>>> are now deprecated but will NOT be removed in near future (so 
>>>>> don't panic!).
>>>>>
>>>>> CHANGES:
>>>>> - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was
>>>>> INTEGER but
>>>>> needs BIGINT to support Long on java side
>>>>>
>>>>> - no longer throw an exception when calling abortTransaction more 
>>>>> than
>>>>> one time
>>>>> or an internal rollback (by ConnectionManager on the used connection)
>>>>> was already done
>>>>>
>>>>> - Add object-cache tag in standard jdbc-connection-descriptor in
>>>>> repository_database.xml
>>>>> to enable new 'autoSync' property of ObjectCacheDefaultImpl for all
>>>>> operations made by
>>>>> this DB connection
>>>>>
>>>>> - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl
>>>>> (handle with care ;-))
>>>>>
>>>>> - odmg-api implementation, disable restore of transient objects on
>>>>> transaction abort,
>>>>> because we can't really restore the whole object with all references
>>>>>
>>>>> - now using ANTLR 2.7.2 and Unicode support in OQL queries
>>>>> - now using ANT 1.6.0
>>>>>
>>>>> - RelationshipPrefetcher no longer modifies auto-retrieve setting of
>>>>> Relationship-Descriptor.
>>>>> This may result in additional sql-queries but is safer in a
>>>>> multi-threaded environment.
>>>>>
>>>>> - Added column methods to Criteria. addColumnEqualTo, addColumnIn 
>>>>> etc.
>>>>> The column parameter
>>>>> of these methods will not be translated during sql-generation. These
>>>>> methods are mainly used
>>>>> for internal purpose.
>>>>>
>>>>> BUG FIXES:
>>>>>
>>>>> Please refer to our Bug tracking site
>>>>> (http://issues.apache.org/scarab/servlet/scarab/)
>>>>> under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx
>>>>> to see details for a bug with id OJBxxx.
>>>>>
>>>>> - fix bug in MetadataManager, when 'per thread changes' is enabled 
>>>>> and
>>>>> many different
>>>>> DescriptorRepository instances were used, gc can't collect unused
>>>>> instances because
>>>>> StatementManager doesn't release references to used 
>>>>> DescriptorRepository
>>>>> instances.
>>>>>
>>>>> - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use 
>>>>> a soft
>>>>> reference
>>>>> for the object wrapper of the cached object. Use a softreference 
>>>>> for the
>>>>> cached
>>>>> object instead
>>>>>
>>>>> - fix bug in CacheDistributor (internal used ObjectCache
>>>>> implementation), each CacheDistributor
>>>>> instance have to held ObjectCache instances for the associated
>>>>> PersistenceBroker instance
>>>>>
>>>>> - fix documentation bug in ObjectCacheDefaultImpl, property 
>>>>> 'timeout' use
>>>>> seconds instead of milliseconds
>>>>>
>>>>> - fix bug in new DList implementation (DListImpl_2), 
>>>>> materialization of
>>>>> objects
>>>>> failed when DList instance itself was persisted (using 
>>>>> db.bind(...)) and
>>>>> re-loaded within tx, but iteration over the list values was done 
>>>>> outside
>>>>> of the tx
>>>>>
>>>>> - The bogus ODMG Distributed Lockmanagement feature has been 
>>>>> replaced by
>>>>> a new
>>>>>   Servlet based LockServer. Transaction isolation should now work
>>>>> properly even
>>>>>   accross a cluster of JVMs.
>>>>>
>>>>> - fix bug in MtoNCollectionPrefetcher, multi-key handling is now 
>>>>> supported.
>>>>>
>>>>> - ClassCastException with ManageableCollection implementations on m:n
>>>>> relation.
>>>>> m:n relation now can handle ManageableCollection collection 
>>>>> classes in a
>>>>> correct way,
>>>>> the collection class no longer needs to implement 
>>>>> java.util.Collection.
>>>>>
>>>>> KNOWN ISSUES:
>>>>> - odmg-api: It is not possible to exchange objects in 1:n references.
>>>>> E.g. two objects with 1:n reference, each with one reference object,
>>>>> obj_1{ref_1}
>>>>> and obj_2{ref_2}. Lock objects and exchange the references in 
>>>>> collection
>>>>> obj_1{ref_2}
>>>>> and obj_2{ref_1} and commit.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>



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


Re: 1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi edson,

executing an additional count on each reference proxy is quite expensive. but i 
have to admit, i do not have a better solution right now :(

jakob

Edson Carlos Ericksson Richter wrote:

> Still with problems when using a 1:0..1 mapping + proxy="dynamic".
> The problem is:
> 
> when making a reference between two objects (X:Y) and there can be 0 or 
> 1 object in Y side, Y must resturn NULL if it don't exists in database, 
> and the object itself if there is 1 object in database. The rule is 
> maintained using same PK for two tables, a foreign key to guarantee data 
> integrity, and a NULL allowed in the X side to allow 0 values in Y side.
> 
> the error is seen when using "proxy='dynamic'" because OJB set, 
> internally, the value to a dynamic proxy. In the code, when you test 
> "myXobject.getY()==null" the result is always false, because getY is 
> returnin a non-materialized proxy. The following code will always throw 
> NPE when are 0 Y objects for a X object (but if proxy="false", there is 
> no error):
> 
> if(myXobject.getY()!=null) {
>  // It always get into here, even when there is no Y value!!!
>  System.out.println(myXobject.getY().getId());
>  // the previous line will throw NPE, because when acessisng getId(), 
> OJB will try to materialize,
>  // since there is no Y object, will try to execute getId() over a null 
> materialized.
> }
> 
> This sayid, I think OJB should execute a count when using a reference as 
> proxy, and when there is 0 object, return null, not a unmaterialized 
> proxy (so the null test in code above will have same behaviour as if 
> it's not proxy).
> 
> What you say?
> 
> Best regards,
> 
> Edson Richter
> 
> 
> Best regards,
> 
> Edson Richter
> 
> 
> Armin Waibel wrote:
> 
>> Hi Edson,
>>
>> edson.richter@mgrinformatica.com.br wrote:
>>
>>> Hmmm, what about the "1:0..1 and proxies test for null is always 
>>> false" and the "afterStore
>>> not being called for collections"? Are they fixed too?
>>>
>>
>> Sorry I don't know. While refactoring the handling of the auto-xxx 
>> code I do my best, but I don't turn my attention to these problems.
>> Could you review/test the rc6/CVS code and repost the problematic spots?
>>
>> regards,
>> Armin
>>
>>>
>>> Best regards,
>>>
>>> Edson Richter
>>>
>>>
>>>
>>>> Dear all,
>>>>
>>>> We've got a new release! Given we find no showstoppers during the next
>>>> week we will approach the Project Management Committee (PMC) of the
>>>> db.apache.org project to get approval to relabel this release as the
>>>> final 1.0 version.
>>>>
>>>> Armin worked hard to get our regression testbed rocksolid. We now have
>>>> more than 600 testcases covering all major areas of the framework!
>>>> I'm confident that this testsuite will help us to maintain and even
>>>> increse the reliability of our code from release to release.
>>>>
>>>> Thanks to all who helped and contributed to this release!
>>>>
>>>> --Thomas
>>>>
>>>>
>>>> From the release notes:
>>>>
>>>> ---------------------------------------------------------------------
>>>> Release 1.0 rc6
>>>> ---------------------------------------------------------------------
>>>>
>>>> NEW FEATURES:
>>>>  -
>>>>
>>>> NOTES:
>>>> - Repository.dtd has changed, don't forget to replace this file
>>>> - Upgraded to the new Apache License, Version 2.0
>>>> - No support for HSQLDB 1.7.2RC1 yet
>>>> - No support for Torque 3.1 yet
>>>>
>>>> - Add new PersistenceBrokerFactory implementation for use in managed
>>>> environments when *only* the
>>>> PB-api was used and participation in JTA transaction via 
>>>> Synchronization
>>>> interface is needed.
>>>>
>>>> - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl.
>>>> Used to enable a simple
>>>> synchronization mechanism to keep cache in sync with DB
>>>>
>>>> - Add new attribute values for reference-/collection-descriptor
>>>> auto-update/-delete attribute.
>>>> Now we have five possible values: none, link, object, true, false. The
>>>> true, false values
>>>> are now deprecated but will NOT be removed in near future (so don't 
>>>> panic!).
>>>>
>>>> CHANGES:
>>>> - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was
>>>> INTEGER but
>>>> needs BIGINT to support Long on java side
>>>>
>>>> - no longer throw an exception when calling abortTransaction more than
>>>> one time
>>>> or an internal rollback (by ConnectionManager on the used connection)
>>>> was already done
>>>>
>>>> - Add object-cache tag in standard jdbc-connection-descriptor in
>>>> repository_database.xml
>>>> to enable new 'autoSync' property of ObjectCacheDefaultImpl for all
>>>> operations made by
>>>> this DB connection
>>>>
>>>> - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl
>>>> (handle with care ;-))
>>>>
>>>> - odmg-api implementation, disable restore of transient objects on
>>>> transaction abort,
>>>> because we can't really restore the whole object with all references
>>>>
>>>> - now using ANTLR 2.7.2 and Unicode support in OQL queries
>>>> - now using ANT 1.6.0
>>>>
>>>> - RelationshipPrefetcher no longer modifies auto-retrieve setting of
>>>> Relationship-Descriptor.
>>>> This may result in additional sql-queries but is safer in a
>>>> multi-threaded environment.
>>>>
>>>> - Added column methods to Criteria. addColumnEqualTo, addColumnIn etc.
>>>> The column parameter
>>>> of these methods will not be translated during sql-generation. These
>>>> methods are mainly used
>>>> for internal purpose.
>>>>
>>>> BUG FIXES:
>>>>
>>>> Please refer to our Bug tracking site
>>>> (http://issues.apache.org/scarab/servlet/scarab/)
>>>> under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx
>>>> to see details for a bug with id OJBxxx.
>>>>
>>>> - fix bug in MetadataManager, when 'per thread changes' is enabled and
>>>> many different
>>>> DescriptorRepository instances were used, gc can't collect unused
>>>> instances because
>>>> StatementManager doesn't release references to used 
>>>> DescriptorRepository
>>>> instances.
>>>>
>>>> - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use a 
>>>> soft
>>>> reference
>>>> for the object wrapper of the cached object. Use a softreference for 
>>>> the
>>>> cached
>>>> object instead
>>>>
>>>> - fix bug in CacheDistributor (internal used ObjectCache
>>>> implementation), each CacheDistributor
>>>> instance have to held ObjectCache instances for the associated
>>>> PersistenceBroker instance
>>>>
>>>> - fix documentation bug in ObjectCacheDefaultImpl, property 
>>>> 'timeout' use
>>>> seconds instead of milliseconds
>>>>
>>>> - fix bug in new DList implementation (DListImpl_2), materialization of
>>>> objects
>>>> failed when DList instance itself was persisted (using db.bind(...)) 
>>>> and
>>>> re-loaded within tx, but iteration over the list values was done 
>>>> outside
>>>> of the tx
>>>>
>>>> - The bogus ODMG Distributed Lockmanagement feature has been 
>>>> replaced by
>>>> a new
>>>>   Servlet based LockServer. Transaction isolation should now work
>>>> properly even
>>>>   accross a cluster of JVMs.
>>>>
>>>> - fix bug in MtoNCollectionPrefetcher, multi-key handling is now 
>>>> supported.
>>>>
>>>> - ClassCastException with ManageableCollection implementations on m:n
>>>> relation.
>>>> m:n relation now can handle ManageableCollection collection classes 
>>>> in a
>>>> correct way,
>>>> the collection class no longer needs to implement java.util.Collection.
>>>>
>>>> KNOWN ISSUES:
>>>> - odmg-api: It is not possible to exchange objects in 1:n references.
>>>> E.g. two objects with 1:n reference, each with one reference object,
>>>> obj_1{ref_1}
>>>> and obj_2{ref_2}. Lock objects and exchange the references in 
>>>> collection
>>>> obj_1{ref_2}
>>>> and obj_2{ref_1} and commit.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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