Dods: Re: Dods digest, Vol 1 #180 - 1 msg
Zvonimir Radulovic <[email protected]> Tue, 30 Dec 2003 02:16:37 -0800 (PST)
| Newsgroups | gmane.comp.java.enhydra.dods |
|---|---|
| Message-ID | <[email protected]> |
--0-1347141443-1072779397=:83472
Content-Type: text/plain; charset=us-ascii
Hi,
I correct this and I don't have this problem, I lose old exception stack trace :(
I am very satisfied with DODS, specially with preformance :),
caching dramatically optimize performace
This is part of my doml:
<table dbTableName="firm" id="books.data.codebook.Firm">
<column id="name" usedForQuery="true">
<type dbType="VARCHAR" javaType="String" size="100"/>
</column>
. . .
</table>
<table dbTableName="provider" id="books.data.codebook.Provider">
<column id="code" usedForQuery="true">
<type dbType="VARCHAR" javaType="String" size="6"/>
</column>
. . .
<column id="firm" usedForQuery="true">
<referenceObject constraint="true" reference="books.data.codebook.Firm"/>
<type dbType="none" javaType="books.data.codebook.FirmDO"/>
</column>
</table>
This is part of my Bussines class :
public Provider() throws BusinessException {
try {
this.myDO = ProviderDO.createVirgin();
} catch(DatabaseManagerException ex) {
throw new BusinessException("Error creating empty Provider", ex);
} catch(ObjectIdException ex) {
throw new BusinessException("Error creating empty Provider", ex);
}
}
. . . .
public void save() throws BusinessException, AssertionDataObjectException {
try {
this.myDO.save();
} catch(Exception ex) {
throw new BusinessException("Error saving Provider", ex);
}
}
When I call save, DODS throws previous exception
The problem is in persistent attribute of Firm. Firm lose persistent (persistent become false)
in checkDup() method od DO class
data = ((ProviderDataStruct)originalData).duplicate();
provider reference objects lose persistent (FirmDO.persistent = false)
ProviderDataStruct class duplicate() method looks like:
ret.code = GenericDO.copyString(code);
ret.firm = books.data.codebook.FirmDO.createCopy( firm );
// This creates a DO that has no ObjectId but has a copy of an existing DO's data.
That was the problem.
I correct that like follows:
1. change DataStruct template to produce next code:
public ProviderDataStruct duplicate()
throws DatabaseManagerException, ObjectIdException {
return duplicate(false);
}
public ProviderDataStruct duplicate(boolean noReference)
throws DatabaseManagerException, ObjectIdException {
ProviderDataStruct ret = new ProviderDataStruct ();
if (!isEmpty) {
ret.code = GenericDO.copyString(code);
if (noReference)
ret.firm = firm;
else
ret.firm = books.data.codebook.FirmDO.createCopy( firm );
}
ret.set_OId(get_OId());
ret.set_Version(get_Version());
ret.databaseName=get_Database();
ret.isEmpty = isEmpty;
return ret;
}
2. change DO template to generate:
public void checkDup () throws DatabaseManagerException,
com.lutris.appserver.server.sql.ObjectIdException {
if (isDeletedFromDatabase)
throw new DatabaseManagerException("Object "+get_OId()+" is deleted");
if (null == data) {
data = ((ProviderDataStruct)originalData).duplicate(true);
data.readOnly = false;
}
}
That solved my problem, but I am not sure that is quite correct, because I don't understand this code.
Regards,
Z. Radulovic
---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing
--0-1347141443-1072779397=:83472
Content-Type: text/html; charset=us-ascii
<DIV>Hi,<BR>I correct this and I don't have this problem, I lose old exception stack trace :(<BR>I am very satisfied with DODS, specially with preformance :),<BR>caching dramatically optimize performace</DIV>
<DIV> </DIV>
<DIV>This is part of my doml:</DIV>
<DIV> <table dbTableName="firm" id="books.data.codebook.Firm"><BR> <column id="name" usedForQuery="true"><BR> <type dbType="VARCHAR" javaType="String" size="100"/><BR> </column><BR> . . . <BR> </table><BR> <table dbTableName="provider" id="books.data.codebook.Provider"><BR> <column id="code" usedForQuery="true"><BR> &n
bsp; <type dbType="VARCHAR" javaType="String"
size="6"/><BR> </column><BR> . . . <BR> <column id="firm" usedForQuery="true"><BR> <referenceObject constraint="true" reference="books.data.codebook.Firm"/><BR> <type dbType="none" javaType="books.data.codebook.FirmDO"/><BR> </column><BR> </table></DIV>
<DIV>This is part of my Bussines class :<BR> <BR> public Provider() throws BusinessException {<BR> try {<BR> this.myDO = ProviderDO.createVirgin();<BR> } catch(DatabaseManagerException ex) {<BR> throw new BusinessException("Error creating empty Provider", ex);<BR> } catch(ObjectIdException ex) {<BR> throw new BusinessException("Error creating empty Provider", ex);<BR> }<BR> }<BR> . . . .</DIV>
<DIV> public void save() throws BusinessException, AssertionDataObjectException {<BR> try {<BR> this.myDO.save();<BR> } catch(Exception ex) {<BR> throw new BusinessException("Error saving Provider", ex);<BR> }<BR> }</DIV>
<DIV>When I call save, DODS throws previous exception</DIV>
<DIV>The problem is in persistent attribute of Firm. Firm lose persistent (persistent become false)</DIV>
<DIV> in checkDup() method od DO class <BR> <BR> data = ((ProviderDataStruct)originalData).duplicate();<BR> <BR> provider reference objects lose persistent (FirmDO.persistent = false)<BR> <BR> ProviderDataStruct class duplicate() method looks like:</DIV>
<DIV> ret.code = GenericDO.copyString(code);<BR> ret.firm = books.data.codebook.FirmDO.createCopy( firm ); <BR> // This creates a DO that has no ObjectId but has a copy of an existing DO's data.</DIV>
<DIV>That was the problem. <BR> <BR>I correct that like follows:</DIV>
<DIV>1. change DataStruct template to produce next code:</DIV>
<DIV> public ProviderDataStruct duplicate() <BR> throws DatabaseManagerException, ObjectIdException {<BR> return duplicate(false);<BR> }</DIV>
<DIV> public ProviderDataStruct duplicate(boolean noReference) <BR> throws DatabaseManagerException, ObjectIdException {<BR> ProviderDataStruct ret = new ProviderDataStruct ();<BR> if (!isEmpty) {<BR> ret.code = GenericDO.copyString(code);<BR> if (noReference)<BR> ret.firm = firm;<BR> else <BR> ret.firm = books.data.codebook.FirmDO.createCopy( firm );<BR> &nb
sp; }<BR>
ret.set_OId(get_OId());<BR> ret.set_Version(get_Version());<BR> ret.databaseName=get_Database();<BR> ret.isEmpty = isEmpty;<BR> return ret;<BR> }</DIV>
<DIV>2. change DO template to generate: <BR> <BR> public void checkDup () throws DatabaseManagerException, </DIV>
<DIV>com.lutris.appserver.server.sql.ObjectIdException {<BR> if (isDeletedFromDatabase)<BR> throw new DatabaseManagerException("Object "+get_OId()+" is deleted");<BR> if (null == data) {<BR> data = ((ProviderDataStruct)originalData).duplicate(true);<BR> data.readOnly = false;<BR> }<BR> }</DIV>
<DIV>That solved my problem, but I am not sure that is quite correct, because I don't understand this code. </DIV>
<DIV>Regards,<BR>Z. Radulovic<BR></DIV><BR><BR><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=21260/*http://photos.yahoo.com">New Yahoo! Photos - easier uploading and sharing</a>
--0-1347141443-1072779397=:83472--