Re: Make dirty of detached objects? Spec Chapter 23
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache JDO Project > Re: Make dirty of detached objects? Spec Chapter 23




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Make dirty of detached objects? Spec Chapter 23  
Andy Jefferson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-03-08 06:11 PM

> 23.17 Generated methods in least-derived PersistenceCapable class
> public final void jdoMakeDirty (String fieldName);

Adding on support for making fields of detached objects dirty means that th=
is=20
signature will likely have to change :-

1. field names are only known about in the "jdoFieldNames" String[] of e
ach=
=20
class. This doesn't matter with non-detached objects since the field name=20
goes straight across to the StateManager. For detached objects a translatio=
n=20
from field name to field number needs to happen to update the right part of=
=20
jdoDetachedState.

2. Some classes in an inheritance tree can be detachable and some not (same=
=20
issue as jdoIsDetached signature change in JDO-459)



With these in mind, for chapter 23 we can have the following
public void jdoMakeDirty(String fieldName)
{
if (jdoStateManager !=3D null)
jdoStateManager.makeDirty(this, fieldName);
}
for non-detachable root classes, and
public void jdoMakeDirty(String fieldName)
{
if (jdoStateManager !=3D null)
jdoStateManager.makeDirty(this, fieldName);
if (jdoIsDetached())
{
if (fieldName !=3D null && fieldName.indexOf('.') >=3D 0)
{
String className =3D fieldName.substring(0,=20
fieldName.lastIndexOf('.'));
if (className.equals(this.getClass().getName())) {
for (int i =3D 0; i < jdoFieldNames.length; i++) {
if (jdoFieldNames[i].equals(fieldName)) {
if (((BitSet) jdoDetachedState[2]).get(i +=20
jdoInheritedFieldCount)) {
((BitSet) jdoDetachedState[3]).set(i +=20
jdoInheritedFieldCount);
return;
}
throw new JDODetachedFieldAccessException("You have jus=
t=20
attempted to access a field/property that hasn't been detached. Please deta=
ch=20
it first before performing this operation");
}
}
}
super.jdoMakeDirty(fieldName);
}
}
}
for detachable classes



=2D-=20
Andy =A0(Java Persistent Objects - http://www.jpox.org)






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:04 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register