New enhydra releases

View: New views
11 Messages — Rating Filter:   Alert me  

New enhydra releases

by Sinisa Milosevic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Dear all,

 

I want to inform you that new releases of Enhydra (www.enhydra.org) open source projects are published.

 

Enhydra Server 7.2-1 (http://forge.objectweb.org/project/showfiles.php?group_id=21)

 

EAF 7.2-1 (Enhydra Application Framework) – (http://forge.objectweb.org/project/showfiles.php?group_id=82)

 

Enhydra DODS 7.2-1 (O/R mapping tool) (http://forge.objectweb.org/project/showfiles.php?group_id=61)

 

Enhydra Demos 7.2-1 (Enhydra Demo Applications) – (http://forge.objectweb.org/project/showfiles.php?group_id=83)

 

Enhydra Octopus 3.6-5 (relational Extraction/Transformation/Loading tool) - (http://forge.objectweb.org/project/showfiles.php?group_id=39)

 

Enhydra Snapper 1.1-1 (fulltext search library / framework) (http://forge.objectweb.org/project/showfiles.php?group_id=188)

 

 

Best regards,

Sinisa Milosevic

Enhydra Development Team

 



--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: New enhydra releases

by João Paulo Ribeiro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi, everybody! :)

We made some internal patches at work to DODS/TRO 7.1 and we are trying to port them to DODS/TRO 7.2 and preparing some diffs to contribute to the community.
But some doubts arised when we did a diff between the 7.1 and 7.2 templates.

The file WriteFileHeaderDO has been changed but i not sure what are the impacts of those changes.
The methods __beginTx(String ldb) and __endTx() methods were added but how are they used?
It looks like they are only useful if we are using JTA. If correct, for example, the method refreshCache() that was changed to force using those methods will not have his behavior changed in any way if we are not using JTA.
Is this assumption correct?

Best regards.
João Paulo Ribeiro

Sinisa Milosevic wrote:

Dear all,

 

I want to inform you that new releases of Enhydra (www.enhydra.org) open source projects are published.

 

Enhydra Server 7.2-1 (http://forge.objectweb.org/project/showfiles.php?group_id=21)

 

EAF 7.2-1 (Enhydra Application Framework) – (http://forge.objectweb.org/project/showfiles.php?group_id=82)

 

Enhydra DODS 7.2-1 (O/R mapping tool) (http://forge.objectweb.org/project/showfiles.php?group_id=61)

 

Enhydra Demos 7.2-1 (Enhydra Demo Applications) – (http://forge.objectweb.org/project/showfiles.php?group_id=83)

 

Enhydra Octopus 3.6-5 (relational Extraction/Transformation/Loading tool) - (http://forge.objectweb.org/project/showfiles.php?group_id=39)

 

Enhydra Snapper 1.1-1 (fulltext search library / framework) (http://forge.objectweb.org/project/showfiles.php?group_id=188)

 

 

Best regards,

Sinisa Milosevic

Enhydra Development Team

 



-- 
João Paulo Ribeiro | Senior Software Engineer
jp@...

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
www.mobicomp.com

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.


--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: New enhydra releases

by João Paulo Ribeiro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Any feedback, please?

Best regards.
João Paulo Ribeiro

João Paulo Ribeiro wrote:
Hi, everybody! :)

We made some internal patches at work to DODS/TRO 7.1 and we are trying to port them to DODS/TRO 7.2 and preparing some diffs to contribute to the community.
But some doubts arised when we did a diff between the 7.1 and 7.2 templates.

The file WriteFileHeaderDO has been changed but i not sure what are the impacts of those changes.
The methods __beginTx(String ldb) and __endTx() methods were added but how are they used?
It looks like they are only useful if we are using JTA. If correct, for example, the method refreshCache() that was changed to force using those methods will not have his behavior changed in any way if we are not using JTA.
Is this assumption correct?

Best regards.
João Paulo Ribeiro

Sinisa Milosevic wrote:

Dear all,

 

I want to inform you that new releases of Enhydra (www.enhydra.org) open source projects are published.

 

Enhydra Server 7.2-1 (http://forge.objectweb.org/project/showfiles.php?group_id=21)

 

EAF 7.2-1 (Enhydra Application Framework) – (http://forge.objectweb.org/project/showfiles.php?group_id=82)

 

Enhydra DODS 7.2-1 (O/R mapping tool) (http://forge.objectweb.org/project/showfiles.php?group_id=61)

 

Enhydra Demos 7.2-1 (Enhydra Demo Applications) – (http://forge.objectweb.org/project/showfiles.php?group_id=83)

 

Enhydra Octopus 3.6-5 (relational Extraction/Transformation/Loading tool) - (http://forge.objectweb.org/project/showfiles.php?group_id=39)

 

Enhydra Snapper 1.1-1 (fulltext search library / framework) (http://forge.objectweb.org/project/showfiles.php?group_id=188)

 

 

Best regards,

Sinisa Milosevic

Enhydra Development Team

 



-- 
João Paulo Ribeiro | Senior Software Engineer
jp@...

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
www.mobicomp.com

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.


-- 
João Paulo Ribeiro | Senior Software Engineer
jp@...

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
www.mobicomp.com

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.


--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: [dods] Re: New enhydra releases

by Vladimir Puškaš :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello João Paulo Ribeiro

Your assumption is correct. Changes there are made only to fix some
problems with JTA behavior.

hth
Vlada

you wrote:

> Any feedback, please?
>
> Best regards.
> João Paulo Ribeiro
>
> João Paulo Ribeiro wrote:
>> Hi, everybody! :)
>>
>> We made some internal patches at work to DODS/TRO 7.1 and we are
>> trying to port them to DODS/TRO 7.2 and preparing some diffs to
>> contribute to the community.
>> But some doubts arised when we did a diff between the 7.1 and 7.2
>> templates.
>>
>> The file WriteFileHeaderDO has been changed but i not sure what are
>> the impacts of those changes.
>> The methods __beginTx(String ldb) and __endTx() methods were added
>> but how are they used?
>> It looks like they are only useful if we are using JTA. If correct,
>> for example, the method refreshCache() that was changed to force
>> using those methods will not have his behavior changed in any way if
>> we are not using JTA.
>>
>> Is this assumption correct?
>> Best regards.
>> João Paulo Ribeiro
>>
>> Sinisa Milosevic wrote:
>>>
>>> Dear all,
>>>
>>>  
>>>
>>> I want to inform you that new releases of Enhydra (www.enhydra.org
>>> <http://www.enhydra.org>) open source projects are published.
>>>
>>>  
>>>
>>> Enhydra Server 7.2-1
>>> (http://forge.objectweb.org/project/showfiles.php?group_id=21)
>>>
>>>  
>>>
>>> EAF 7.2-1 (Enhydra Application Framework) –
>>> (http://forge.objectweb.org/project/showfiles.php?group_id=82)
>>>
>>>  
>>>
>>> Enhydra DODS 7.2-1 (O/R mapping tool)
>>> (http://forge.objectweb.org/project/showfiles.php?group_id=61)
>>>
>>>  
>>>
>>> Enhydra Demos 7.2-1 (Enhydra Demo Applications) –
>>> (http://forge.objectweb.org/project/showfiles.php?group_id=83)
>>>
>>>  
>>>
>>> Enhydra Octopus 3.6-5 (relational Extraction/Transformation/Loading
>>> tool) - (http://forge.objectweb.org/project/showfiles.php?group_id=39)
>>>
>>>  
>>>
>>> Enhydra Snapper 1.1-1 (fulltext search library / framework)
>>> (http://forge.objectweb.org/project/showfiles.php?group_id=188)
>>>
>>>  
>>>
>>>  
>>>
>>> Best regards,
>>>
>>> Sinisa Milosevic
>>>
>>> Enhydra Development Team
>>>
>>>  
>>>
>>
>>
>> --
>> João Paulo Ribeiro | Senior Software Engineer
>> jp@...
>>
>> PHONE: + 351 253 305 250
>> FAX  : + 351 253 305 250
>> www.mobicomp.com
>>
>> ________________________________________________________________
>>
>> About Solutions | Wireless World
>>
>> CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
>> DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.
>
>
> --
> João Paulo Ribeiro | Senior Software Engineer
> jp@...
>
> PHONE: + 351 253 305 250
> FAX  : + 351 253 305 250
> www.mobicomp.com
>
> ________________________________________________________________
>
> About Solutions | Wireless World
>
> CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
> DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.




--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Parent Message unknown Re: [dods] Re: New enhydra releases

by João Paulo Ribeiro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, Vladimir.

Then nothing changed for people that are not using jta.
Assuming that, i think that the templates are generating code with
dbconnection leak in case of error:  the dbtransaction is created but
the transaction release is not done in a finally block to ensure that
the dbconnection is released and avoid dbconnection leak.

For example, in file writeFileFooterDO8.xsl the method
save(DBTransaction dbt, boolean references), used to save the objects:

public void save(DBTransaction dbt, boolean references)
    throws SQLException, DatabaseManagerException, DataObjectException,
RefAssertionException, DBRowUpdateException, QueryException {
        if (cache.getTableConfiguration().isReadOnly()) {
            throw new AssertionDataObjectException("<xsl:value-of
select="CLASS_NAME"/>DO's cache is read-only. Therefore, DML opertions
are not allowed.");
        }
        // before: modifyDO( dbt, false );
        // The following line has been inserted:
        try {
            // WebDocWf extension for generic store
            // The following line has been inserted:
            DBTransaction dbtlocal = dbt;
            boolean needToCommit = false;

            if (dbtlocal == null) {
              if( get_transaction()==null) {
                dbtlocal =
DODS.getDatabaseManager().createTransaction(get_OriginDatabase());
                dbtlocal.setDatabaseName(get_OriginDatabase());
                needToCommit = true;
              }
             else
                dbtlocal=transaction;
            } else {<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                if (
!dbtlocal.getDatabaseName().equals(get_OriginDatabase()) ) {
                    throw new DatabaseManagerException("Logical database
of transaction is different from DO's.");
                }
</xsl:if>
                if(get_transaction()!=null) {
                    if(!get_transaction().equals(dbt))
                          throw new DatabaseManagerException("DO doesn't
belong this transaction.");
                }
            }

            // The following line has been changed:
            modifyDO( dbtlocal, false, references );
            if (needToCommit) {
                dbtlocal.commit();
                dbtlocal.release();
            }
        } catch (DataObjectException e) {
            modifyDO( dbt, false );
        }
        // end of WebDocWf extension for generic store
    }

What happens if the insert fails?  We detected this situation  when  the
values inserted  were rejected by the database (constraints,  unique
rules,etc.). In this case, the dbconnection was never returned to the
dbpool.

We did some changes to the templates trying to ensure that when a
transaction is created locally, in a method, this transaction is always
released in that method using a finally block.

Some of this changes were tested in production environment others were not.

Attached you can find the templates (TRO/DODS 7.2.1) we changed. If you
want i can send you a diff.
Let me know if there is something wrong with our approach or our
assumptions.

Best regards.
João Paulo Ribeiro

PS: we have other patches to the QueryBuilder.java but this will
discussed in another email. :)


Vladimir Puškaš wrote:

> Hello João Paulo Ribeiro
>
> Your assumption is correct. Changes there are made only to fix some
> problems with JTA behavior.
>
> hth
> Vlada
>
> you wrote:
>> Any feedback, please?
>>
>> Best regards.
>> João Paulo Ribeiro
>>
>> João Paulo Ribeiro wrote:
>>> Hi, everybody! :)
>>>
>>> We made some internal patches at work to DODS/TRO 7.1 and we are
>>> trying to port them to DODS/TRO 7.2 and preparing some diffs to
>>> contribute to the community.
>>> But some doubts arised when we did a diff between the 7.1 and 7.2
>>> templates.
>>>
>>> The file WriteFileHeaderDO has been changed but i not sure what are
>>> the impacts of those changes.
>>> The methods __beginTx(String ldb) and __endTx() methods were added
>>> but how are they used?
>>> It looks like they are only useful if we are using JTA. If correct,
>>> for example, the method refreshCache() that was changed to force
>>> using those methods will not have his behavior changed in any way if
>>> we are not using JTA.
>>>
>>> Is this assumption correct?
>>> Best regards.
>>> João Paulo Ribeiro
>>>
>>> Sinisa Milosevic wrote:
>>>>
>>>> Dear all,
>>>>
>>>>  
>>>>
>>>> I want to inform you that new releases of Enhydra (www.enhydra.org
>>>> <http://www.enhydra.org>) open source projects are published.
>>>>
>>>>  
>>>>
>>>> Enhydra Server 7.2-1
>>>> (http://forge.objectweb.org/project/showfiles.php?group_id=21)
>>>>
>>>>  
>>>>
>>>> EAF 7.2-1 (Enhydra Application Framework) –
>>>> (http://forge.objectweb.org/project/showfiles.php?group_id=82)
>>>>
>>>>  
>>>>
>>>> Enhydra DODS 7.2-1 (O/R mapping tool)
>>>> (http://forge.objectweb.org/project/showfiles.php?group_id=61)
>>>>
>>>>  
>>>>
>>>> Enhydra Demos 7.2-1 (Enhydra Demo Applications) –
>>>> (http://forge.objectweb.org/project/showfiles.php?group_id=83)
>>>>
>>>>  
>>>>
>>>> Enhydra Octopus 3.6-5 (relational Extraction/Transformation/Loading
>>>> tool) - (http://forge.objectweb.org/project/showfiles.php?group_id=39)
>>>>
>>>>  
>>>>
>>>> Enhydra Snapper 1.1-1 (fulltext search library / framework)
>>>> (http://forge.objectweb.org/project/showfiles.php?group_id=188)
>>>>
>>>>  
>>>>
>>>>  
>>>>
>>>> Best regards,
>>>>
>>>> Sinisa Milosevic
>>>>
>>>> Enhydra Development Team
>>>>
>>>>  
>>>>
>>>
>>>
>>> --
>>> João Paulo Ribeiro | Senior Software Engineer
>>> jp@...
>>>
>>> PHONE: + 351 253 305 250
>>> FAX  : + 351 253 305 250
>>> www.mobicomp.com
>>>
>>> ________________________________________________________________
>>>
>>> About Solutions | Wireless World
>>>
>>> CONFIDENTIALITY NOTICE: This message, as well as existing attached
>>> files, is confidential and intended exclusively for the
>>> individual(s) named as addressees. If you are not the intended
>>> recipient, you are kindly requested not to make any use whatsoever
>>> of its contents and to proceed to the destruction of the message,
>>> thereby notifying the sender.
>>> DISCLAIMER: The sender of this message can not ensure the security
>>> of its electronic transmission and consequently does not accept
>>> liability for any fact which may interfere with the integrity of its
>>> content.
>>
>>
>> --
>> João Paulo Ribeiro | Senior Software Engineer
>> jp@...
>>
>> PHONE: + 351 253 305 250
>> FAX  : + 351 253 305 250
>> www.mobicomp.com
>>
>> ________________________________________________________________
>>
>> About Solutions | Wireless World
>>
>> CONFIDENTIALITY NOTICE: This message, as well as existing attached
>> files, is confidential and intended exclusively for the individual(s)
>> named as addressees. If you are not the intended recipient, you are
>> kindly requested not to make any use whatsoever of its contents and
>> to proceed to thedestruction of the message, thereby notifying the
>> sender.
>> DISCLAIMER: The sender of this message can not ensure the security of
>> its electronic transmission and consequently does not accept
>> liability forany fact which may interfere with the integrity of its
>> content.
>
>
>
>
>

--
João Paulo Ribeiro | Senior Software Engineer
jp@...

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
www.mobicomp.com

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached
files, is confidential and intended exclusively for the individual(s)
named as addressees. If you are not the intended recipient, you are
kindly requested not to make any use whatsoever of its contents and to
proceed to the destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of
its electronic transmission and consequently does not accept liability
for any fact which may interfere with the integrity of its content.



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xalan="http://xml.apache.org/xslt"
                xmlns:stu="org.ejen.ext.StringUtil"
                version="1.0">
    <xsl:output method="text" encoding="utf-8"/>
    <xsl:template name="fileFooter8">
<xsl:value-of select="N21_REFERRERS"/>
<xsl:value-of select="N2N_REFERRERS"/>
    /**
     * A stub method for implementing pre-commit assertions
     * for this <xsl:value-of select="CLASS_NAME"/>DO.
     * Implement this stub to throw an RefAssertionException for cases
     * where this object is not valid for writing to the database.
     * @exception RefAssertionException
     */
    protected void okToCommit()
    throws RefAssertionException {
    }

    /**
     * A stub method for implementing pre-delete assertions
     * for this <xsl:value-of select="CLASS_NAME"/>DO.
     * Implement this stub to throw an RefAssertionException for cases
     * where this object is not valid for deletion from the database.
     * @exception RefAssertionException
     */
    protected void okToDelete() throws RefAssertionException {  }

    /**
     * Inserts/Updates the DO into its table.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * @deprecated Use save() instead.
     */
    public void commit()
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        commit(null);
    }

    /**
     * Inserts/Updates the DO into its table.
     * The transaction is likely provided by the commit() method of another DO
     * which references this DO.
     *
     * @param dbt The transaction object used for this operation.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * @deprecated Use save() instead.
     */
    public void commit(DBTransaction dbt)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        if (cache.getTableConfiguration().isReadOnly())
            throw new AssertionDataObjectException("<xsl:value-of select="CLASS_NAME"/>DO's cache is read-only. Therefore, DML opertions are not allowed.");
        // WebDocWf extension for generic store
        // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            DBTransaction dbtlocal = dbt;
            boolean needToCommit = false;
        try {
            // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            // DBTransaction dbtlocal = dbt;
            // boolean needToCommit = false;
            if (dbtlocal == null) {
               if( get_transaction()==null) {
                  dbtlocal = DODS.getDatabaseManager().createTransaction(get_OriginDatabase());
                  dbtlocal.setDatabaseName(get_OriginDatabase());
                  needToCommit = true;
               }else
                  dbtlocal=transaction;
            } else {<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                if ( !dbtlocal.getDatabaseName().equals(get_OriginDatabase()) ) {
                    throw new DatabaseManagerException("Logical database of transaction is different from DO's.");
                }
</xsl:if>
                if(get_transaction()!=null) {
                   if(!get_transaction().equals(dbt))
                         throw new DatabaseManagerException("DO doesn't belong this transaction.");
                }
            }
            modifyDO( dbtlocal, false );
            if (needToCommit) {
                dbtlocal.commit();
                //JP 2007-10-09 - Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
                //dbtlocal.release();
            }
        } catch (DataObjectException e) {
            modifyDO( dbt, false );
        }
        //JP 2007-10-09 - Added dbtolocal.rollback() only if the transaction has been allocated by this code
        // Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
        catch (SQLException sqle) {
            StringBuffer message = new StringBuffer("Failed to commit DO: ");
            message.append(sqle.getMessage());
            // rollback, if necessary
            if (needToCommit) {
                try {
                    dbtlocal.rollback();
                } catch (SQLException sqle2) {
                    message.insert(0,"\n");
                    message.insert(0,sqle2.getMessage());
                    message.insert(0,"Rollback failed: ");
                }
            }
            throw new SQLException(message.toString());
        } finally {
            // release the transaction, if any
            if (needToCommit) {
                dbtlocal.release();
            }
        }
        // end of WebDocWf extension for generic store
    }

    /**
     * Inserts/Updates the DO into its table.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * WebDocWf extension
     */
    public void save()
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        save(get_transaction(),true);
    }

    /**
     * Inserts/Updates the DO into its table.
     *
     * @param references True if references should be saved with this DO.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * WebDocWf extension
     */
    public void save(boolean references)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        save(get_transaction(),references);
    }

    /**
     * Inserts/Updates the DO into its table.
     * The transaction is likely provided by the commit() method of another DO
     * which references this DO.
     *
     * @param dbt The transaction object used for this operation.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * WebDocWf extension
     */
    public void save(DBTransaction dbt)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        save(dbt, true);
    }

    /**
     * Inserts/Updates the DO into its table.
     * The transaction is likely provided by the commit() method of another DO
     * which references this DO.
     *
     * @param dbt The transaction object used for this operation.
     * @param references True if references of this DO should be saved.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     *
     * WebDocWf extension
     */
    public void save(DBTransaction dbt, boolean references)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        if (cache.getTableConfiguration().isReadOnly()) {
            throw new AssertionDataObjectException("<xsl:value-of select="CLASS_NAME"/>DO's cache is read-only. Therefore, DML opertions are not allowed.");
        }    
        // before: modifyDO( dbt, false );
        // The following line has been inserted:
        // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
        DBTransaction dbtlocal = dbt;
        boolean needToCommit = false;
        try {  
            // WebDocWf extension for generic store
            // The following line has been inserted:
            // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            // DBTransaction dbtlocal = dbt;
            // boolean needToCommit = false;

            if (dbtlocal == null) {
              if( get_transaction()==null) {
                dbtlocal = DODS.getDatabaseManager().createTransaction(get_OriginDatabase());
                dbtlocal.setDatabaseName(get_OriginDatabase());
                needToCommit = true;
              }
             else
                dbtlocal=transaction;
            } else {<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                if ( !dbtlocal.getDatabaseName().equals(get_OriginDatabase()) ) {
                    throw new DatabaseManagerException("Logical database of transaction is different from DO's.");
                }
</xsl:if>
                if(get_transaction()!=null) {
                    if(!get_transaction().equals(dbt))
                          throw new DatabaseManagerException("DO doesn't belong this transaction.");
                }
            }

            // The following line has been changed:
            modifyDO( dbtlocal, false, references );
            if (needToCommit) {
                dbtlocal.commit();
                //JP 2007-10-09 - Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
                //dbtlocal.release();
            }
        } catch (DataObjectException e) {
            modifyDO( dbt, false );
        }  
        //JP 2007-10-09 - Added dbtolocal.rollback() only if the transaction has been allocated by this code
        // Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
        catch (SQLException sqle) {
            StringBuffer message = new StringBuffer("Failed to insert/update DO: ");
            message.append(sqle.getMessage());
            // rollback, if necessary
            if (needToCommit) {
                try {
                    dbtlocal.rollback();
                } catch (SQLException sqle2) {
                    message.insert(0,"\n");
                    message.insert(0,sqle2.getMessage());
                    message.insert(0,"Rollback failed: ");
                }
            }
            throw new SQLException(message.toString());
        } finally {
            // release the transaction, if any
            if (needToCommit) {
                dbtlocal.release();
            }
        }        
        // end of WebDocWf extension for generic store
    }

    /**
     * Deletes the DO from its table.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     */
    public void delete()
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        delete(get_transaction(), true);
    }


        /**
         * Deletes the DO from its table.
         *
     * @param dbt The transaction object used for this operation.
         *
         * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
         * @exception RefAssertionException Thrown by okTo method.
         * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
         */
        public void delete(DBTransaction dbt)
        throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
                delete(dbt,true);
        }


    /**
     * UnDeletes the DO and inserts to the table.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     */
    public void unDelete()
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        unDelete(get_transaction());
    }
   
    /**
     * Deletes the DO from its table.
     * The transaction is likely provided by the delete() method of another DO
     * which references this DO.
     * NOTE : This method is only for DODS internal usage.
     * @param dbt The transaction object used for this operation.
     * @param rootDO Is DO root in DELETE CASCADE sekvence
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     */
    public void delete(DBTransaction dbt, boolean rootDO)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
        isRootDeleteNode = rootDO ;
        if (cache.getTableConfiguration().isReadOnly())
            throw new AssertionDataObjectException("<xsl:value-of select="CLASS_NAME"/>DO's cache is read-only. Therefore, DML opertions are not allowed.");
        // WebDocWf extension for generic store
        // The following lines have been inserted:
        // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            DBTransaction dbtlocal = dbt;
            boolean needToCommit = false;
        try {      
            // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            // DBTransaction dbtlocal = dbt;
            // boolean needToCommit = false;
            if (dbtlocal == null) {
              if(get_transaction()==null) {
                dbtlocal = DODS.getDatabaseManager().createTransaction(get_OriginDatabase());
                dbtlocal.setDatabaseName(get_OriginDatabase());
                needToCommit = true;
              }
              else
                dbtlocal=transaction;  
            } else {<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                if ( !dbtlocal.getDatabaseName().equals(get_OriginDatabase()) ) {
                    throw new DatabaseManagerException("Logical database of transaction is different from DO's.");
                }
</xsl:if>
                if(get_transaction()!=null) {
                    if(!get_transaction().equals(dbtlocal))
                        throw new DatabaseManagerException("DO doesn't belong this transaction.");
                }
            }
            // The following line has been changed:
            modifyDO( dbtlocal, true );
            // end of WebDocWf extension for generic store
            if (needToCommit) {
                dbtlocal.commit();
                //JP 2007-10-09 - Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
                //dbtlocal.release();
            }
        } catch (DataObjectException e) {
            modifyDO( dbt, true );
        }
        //JP 2007-10-09 - Added dbtolocal.rollback() only if the transaction has been allocated by this code
        // Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
        catch (SQLException sqle) {
            StringBuffer message = new StringBuffer("Failed to delete DO: ");
            message.append(sqle.getMessage());
            // rollback, if necessary
            if (needToCommit) {
                try {
                    dbtlocal.rollback();
                } catch (SQLException sqle2) {
                    message.insert(0,"\n");
                    message.insert(0,sqle2.getMessage());
                    message.insert(0,"Rollback failed: ");
                }
            }
            throw new SQLException(message.toString());
        } finally {
            // release the transaction, if any
            if (needToCommit) {
                dbtlocal.release();
            }
        }
       
    }

    /**
     * UnDeletes the DO and inserts to the table.
     *
     * @param dbt The transaction object used for this operation.
     *
     * @exception com.lutris.appserver.server.sql.DatabaseManagerException If a Transaction can not be created.
     * @exception RefAssertionException Thrown by okTo method.
     * @exception java.sql.SQLException If any SQL errors occur.
     * @exception DataObjectException
     * @exception DBRowUpdateException
     * @exception QueryException
     */
    public void unDelete(DBTransaction dbt)
    throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
     
     if (cache.getTableConfiguration().isReadOnly())
            throw new AssertionDataObjectException("<xsl:value-of select="CLASS_NAME"/>DO's cache is read-only. Therefore, DML opertions are not allowed.");
        // WebDocWf extension for generic store
        // The following lines have been inserted:
        // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            DBTransaction dbtlocal = dbt;
            boolean needToCommit = false;
        try {
            // JP 2007-10-09 - Moved outside of the try block to allow dbtlocal.release() in the finally block
            // DBTransaction dbtlocal = dbt;
            // boolean needToCommit = false;
            if (dbtlocal == null) {
              if(get_transaction()==null) {
                dbtlocal = DODS.getDatabaseManager().createTransaction(get_OriginDatabase());
                dbtlocal.setDatabaseName(get_OriginDatabase());
                needToCommit = true;
              }
              else
                dbtlocal=transaction;  
            } else {<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                if ( !dbtlocal.getDatabaseName().equals(get_OriginDatabase()) ) {
                    throw new DatabaseManagerException("Logical database of transaction is different from DO's.");
                }
</xsl:if>
           if(get_transaction()!=null) {
                if(!get_transaction().equals(dbtlocal))
                    throw new DatabaseManagerException("DO didn't belong this transaction.");
           }
          }
          setDeleted(false);
         isDeletedFromDatabase = false;
          persistent=false;
          modifyDO( dbtlocal, false );
          if (needToCommit) {
                dbtlocal.commit();
                //JP 2007-10-09 - Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
                //dbtlocal.release();
          }
          isDeletedFromDatabase = false;
        } catch (DataObjectException e) {
            persistent=true;
            setDeleted(true);
        }
        //JP 2007-10-09 - Added dbtolocal.rollback() only if the transaction has been allocated by this code
        // Moved dbtlocal.release() to a finally block to avoid dbconnection leak.
        catch (SQLException sqle) {
            StringBuffer message = new StringBuffer("Failed to undelete DO: ");
            message.append(sqle.getMessage());
            // rollback, if necessary
            if (needToCommit) {
                try {
                    dbtlocal.rollback();
                } catch (SQLException sqle2) {
                    message.insert(0,"\n");
                    message.insert(0,sqle2.getMessage());
                    message.insert(0,"Rollback failed: ");
                }
            }
            throw new SQLException(message.toString());
        } finally {
            // release the transaction, if any
            if (needToCommit) {
                dbtlocal.release();
            }
        }        
    }

    </xsl:template>
</xsl:stylesheet>


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:dodst="org.enhydra.dods.xslt.DODSTag"
                xmlns:common="org.enhydra.dods.Common"
                version="1.0">
        <xsl:output method="text" encoding="utf-8"/>
<xsl:template name="fileHeader">
<xsl:value-of select="dodst:initColumn()"/>
/*-----------------------------------------------------------------------------
 * Enhydra Java Application Server
 * Copyright 1997-2000 Lutris Technologies, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    This product includes Enhydra software developed by Lutris
 *    Technologies, Inc. and its contributors.
 * 4. Neither the name of Lutris Technologies nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY LUTRIS TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL LUTRIS TECHNOLOGIES OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * contains WebDocWf extensions
 *
 *-----------------------------------------------------------------------------
 * <xsl:value-of select="PACKAGE"/>/<xsl:value-of select="CLASS_NAME"/>DO.java
 *-----------------------------------------------------------------------------
 */

<xsl:value-of select="dodst:resetCounter()"/>
package <xsl:value-of select="translate(PACKAGE,'/','.')"/>;

import java.io.*;
import java.sql.*;
import java.math.*;
import java.util.*;
import java.lang.reflect.Method;

import com.lutris.logging.*;
import com.lutris.util.*;
import com.lutris.appserver.server.sql.*;
import com.lutris.appserver.server.sql.standard.*;
import com.lutris.classloader.MultiClassLoader;
import com.lutris.dods.builder.generator.dataobject.*;
import com.lutris.dods.builder.generator.query.*;
import org.enhydra.dods.*;
import org.enhydra.dods.cache.*;
import org.enhydra.dods.exceptions.*;
import org.enhydra.dods.statistics.Statistics;
import org.enhydra.xml.XMLConfig;
import org.enhydra.dods.cache.UpdateConfigurationAdministration;

<xsl:if test="DO_IS_OID_BASED='true'">
// WebDocWf extension for DODS row instance security and genric store
import org.webdocwf.dods.access.*;
// end of WebDocWf extension for DODS row instance security and generic store
</xsl:if>
/**
 * Data core class, used to set and retrieve the <xsl:value-of select="CLASS_NAME"/>DO information.
 *
 * @version $Revision: 1.24 $
 * @author  <xsl:value-of select="AUTHOR"/>
 * @since   <xsl:value-of select="PROJECT_NAME"/>
 */
<xsl:if test="IS_ABSTRACT='true'">abstract</xsl:if> public class <xsl:value-of select="CLASS_NAME"/>DO extends <xsl:if test="(GENERATE_SECURE='true' or IS_ANY_COLUMN_SECURE='true') and DO_IS_OID_BASED='true'">org.webdocwf.dods.access.SecureDO</xsl:if><xsl:if test="not((GENERATE_SECURE='true' or IS_ANY_COLUMN_SECURE='true') and DO_IS_OID_BASED='true')">com.lutris.dods.builder.generator.dataobject.GenericDO</xsl:if> implements <xsl:value-of select="CLASS_NAME"/>DOI, java.io.Serializable {
    /**
     * Static final data members name the table and columns for this DO.
     * By using these members with an instance of the QueryBuilder class,
     * an application can perform straight SQL queries while retaining
     * compile-time checking of table and column usage.
     *
     * Example:  List the Cities containing Persons named Bob:
     *
     *    Using straight SQL with QueryBuilder:
     *      Pro: code runs faster because you create fewer objects
     *      Con: code is less clear
     *
     *         Vector fields = new Vector();
     *         fields.addElement( AddressDO.City );
     *         QueryBuilder qb = new QueryBuilder( fields );
     *         qb.addWhere( PersonDO.FirstName, "Bob" );
     *         qb.addWhere( PersonDO.PrimaryKey, AddressDO.Person );
     *         RDBRow row;
     *         while ( null != ( row = qb.getNextRow() ) ) {
     *             String city = row.get( AddressDO.City ).getString();
     *         }
     *
     *    Using Query/DO classes:
     *      Pro: code is (often) clearer
     *      Con: code runs slower because you create more objects
     *
     *         PersonQuery pq = new PersonQuery();
     *         pq.setQueryFirstName( "Bob" );
     *         PersonDO[] bobs = pq.getDOArray();
     *         for ( int i = 0; i < bobs.length; i++ ) {
     *             AddressQuery aq = new AddressQuery();
     *             aq.setQueryPerson( bobs[i] );
     *             AddressDO addr = aq.getNextDO();
     *             String city = addr.getCity();
     *         }
     */
    static public final String tableName = "<xsl:value-of select="TABLE_NAME"/>";
    static public final RDBTable  table = new RDBTable(tableName);

    /**
    * null : use old style init query
    * true : use columns names with table prefix
    * false: use columns names withouth table prefix
    */
    private static Boolean useOrderedWithTable = null ;


    /**
    * true : Use binary stream for longvarchar
    * false: Don't use binary stream for longvarchar
    */
    private static boolean useBinaryStreamForLongvarchar ;

    /**
    * String with column names
    */
        static String columnsNameString = null;


    /**
    * Is DO first node in DELETE CASCADE sekvence
    */
    private boolean isRootDeleteNode = true;
   
   
    /**
    * Identity Type of DO class
    */    
    private static int objectIdentityType = -1;
   
   
    /**
     * If asynchronous cache initialization is needed, the attribute has value
     * "true", otherwise "false".
     */
    private static boolean asynchCacheLoadNeeded = false; // tj added 25.02.2006

    /**
     * If the number of results in the table is greater than the number  defined
     * with parameter "simpleCacheRowCountLimit", simple cache is not used.
     */
    private static boolean simpleCacheUsed = true; // tj added 07.07.2006

    /**
     * Return the name of the logical database for which DO object was created.
     *
     * @return origin logical database name.
     *
     */
    public String get_OriginDatabase() {
        return get_DataStruct().get_Database();
    }

    /**
     * Return <xsl:value-of select="TABLE_NAME"/> as the name of the table in the database
     * which contains <xsl:value-of select="CLASS_NAME"/>DO objects.
     * This method overrides CoreDO.getTableName()
     * and is used by CoreDO.executeUpdate() during error handling.
     *
     * @return The database table name.
     *
     * @see com.lutris.appserver.server.sql.CoreDO CoreDO
     * author Jay Gunter
     */
    public String getTableName() {
        return tableName;
    }
<xsl:if test="DO_IS_OID_BASED='true'">
    /**
     * static final RDBColumn PrimaryKey for use with QueryBuilder.
     * See example above.
     */
    static public final RDBColumn PrimaryKey = new RDBColumn( table, get_primaryKeyName() );

    /* RDBColumns for <xsl:value-of select="CLASS_NAME"/>DO attributes are defined below. */
</xsl:if>

    /* Using a DO (and its Query class) to access a VIEW instead of a TABLE:
     *
     * A DO (and its Query class) can be used to access a VIEW
     * instead of a TABLE.  The Data Object is created as usual in DODS,
     * but the "create table" SQL command for that DO is not used.
     * Instead, you substitute a "create view" command to create a
     * virtual table in the database; this is often done to provide
     * convenient access to a collection of tables joined together.
     *
     * A VIEW usually does not return "oid" and "version" columns;
     * often (but now always) a VIEW is defined to return the "oid" column
     * for one of the tables joined together in the definition of the VIEW.
     *
     * If notUsingOId is true, <xsl:value-of select="CLASS_NAME"/>DO.createExisting(ResultSet)
     * will NOT invoke the GenericDO(ResultSet) constructor
     * so to avoid attempting to extract the "oid" and "version" columns
     * from the ResultSet.
     */
<xsl:if test="DO_IS_OID_BASED='false'">    static protected final boolean notUsingOId = true;
</xsl:if>
<xsl:if test="DO_IS_OID_BASED='true'">    static protected final boolean notUsingOId = false;
</xsl:if>

    /**
     * A DO class contains a reference to a DataStruct class.
     * This reference can be null (when the data for the DO
     * has not yet been retrieved from the database),
     * allowing a DO object to be a lightweight placeholder
     * until its data is needed.
     */
    private <xsl:value-of select="CLASS_NAME"/>DataStruct data = null;

    /**
     * A DO class contains a reference to a DBTransaction class.
     * This reference can be null (when the DO is created without
     * transaction).
     */
    private DBTransaction transaction = null;

    /**
     * Return transaction which DO belongs.
     *
     * @return DBTransaction or null if not specified.
     *
     */
    public DBTransaction get_transaction() {
        return transaction;
    }

    /**
     * Set Transaction to current DO.
     *
     * @param trans The transaction.
     * @return true if the operation was successfully performed, otherwise false.
     */
    protected boolean setTransaction(DBTransaction trans) {
        boolean isOK=false;
        if (get_transaction() == null) {
            transaction = trans;
            isOK=true;
        } else {
        if(get_transaction().equals(trans))
            isOK=true;
        }
        return isOK;
    }

    /**
     * Return information whether the data for this object has been marked read-only.
     *
     * @return True if the data for this object has been marked read-only.
     *
     */
    public boolean isReadOnly() {
      return getConfigurationAdministration().getTableConfiguration().isReadOnly();
     }


    /**
     * Return the type of the identity column(s) of DOs that these objects represents.
     * This method should be overridden by derived classes.
     *
     * @return the identity type of DOs
     * @see org.enhydra.dods.CommonConstants#OBJECT_IDENTITY_TYPE
     */
    public  int objectIdentityType(){
    if (objectIdentityType==-1){
            objectIdentityType = getConfigurationAdministration()
                                     .getTableConfiguration()
                                     .getObjectIdentityType();
    }
    return objectIdentityType;
    }


    /**
     * Sets DO's data.
     * @param data Data object.
     */
     public void set_Data (Object data) {
        this.data = (<xsl:value-of select="CLASS_NAME"/>DataStruct)data;
     }

    /**
     * Sets original DO's data.
     * @param value Data object.
     */
     public void originalData_set (Object value) {
        originalData = (<xsl:value-of select="CLASS_NAME"/>DataStruct)value;
     }

    /**
     * Returns DO's data.
     * @return DO's data.
     */
     public Object get_Data () {
        return (null != data)? data : originalData;
     }

    /**
     * Returns dataStruct.
     * @return Data Struct object.
     * @deprecated Use get_DataStruct()
     */
    public <xsl:value-of select="CLASS_NAME"/>DataStruct getDataStruct () {
        return get_DataStruct();
    }

    /**
     * Returns dataStruct.
     * @return Data Struct object.
     */
    public <xsl:value-of select="CLASS_NAME"/>DataStruct get_DataStruct () {
        return (<xsl:value-of select="CLASS_NAME"/>DataStruct) get_Data();
    }

    /**
     * Returns original DO's data.
     * @return Original DO's data.
     */
     public Object originalData_get () {
        return originalData;
     }

    /**
     * Load the actual DO data if necessary.
     * Called by get/set methods.
     * @param duplicateToo if true DataStruct will be duplicated
     *
     * @exception DataObjectException If a data access error occurs.
     */
    private void checkLoad(boolean duplicateToo) throws DataObjectException {
        if (null == originalData||get_DataStruct().isEmpty()) {
            try {
                loadData();
            } catch ( Exception e ) {
                throw new DataObjectException("Unable to load data for <xsl:value-of select="CLASS_NAME"/>DO id="
                                              + get_OId() +", error = ", e);
            }
        }
        if (duplicateToo) {
            if (isDeletedFromDatabase)
                throw new DataObjectException("Object "+get_OId()+" is deleted");
            if (null == data) {
                data = ((<xsl:value-of select="CLASS_NAME"/>DataStruct)originalData).duplicate();
                data.readOnly = false;
            }
        }
    }

    /**
     * Protected constructor. Only derived classes should call it.
     *
     * @param is_view Is this view or not.
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO ( boolean is_view )
    throws ObjectIdException, DatabaseManagerException {
        super( is_view );
        if(isTransactionCheck()) {
            printMsg(Logger.WARNING, "DO without transaction context is created :"+(is_view?"":" Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version())+" \n");
            (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

        }
    }
    /**
     * Protected constructor. Only derived classes should call it.
     *
     * @param is_view Is this view or not.
     * @param dbTrans Database transaction.
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO ( boolean is_view, DBTransaction dbTrans )
    throws ObjectIdException, DatabaseManagerException {
        super( is_view );
        setTransaction(dbTrans);
        String originDatabase = null;
        if(dbTrans!=null) {
           originDatabase = dbTrans.getDatabaseName();
        }
        if(originDatabase==null)
           originDatabase = get_logicalDBName();<xsl:if test="DO_IS_MULTIDB_BASED='true'">
        else {
           try {
            if(useLogicalDatabase(originDatabase))
               readCacheConfiguration(originDatabase);
           } catch (Exception ex) {
             printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+originDatabase+"' database");
           }
         }</xsl:if>
        get_DataStruct().set_Database(originDatabase);
        addToTransactionCache(this, dbTrans);

    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'">
    /**
     * Protected constructor. Only derived classes should call it.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param is_view
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO (String dbName,  boolean is_view)
    throws ObjectIdException, DatabaseManagerException {
        super(dbName,is_view);
        if (dbName == null)
            dbName = get_logicalDBName();
        if(useLogicalDatabase(dbName)) {
          try {
            readCacheConfiguration(dbName);
          } catch (Exception ex) {
             printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+dbName+"' database");
          }
        }
        get_DataStruct().set_Database(dbName);
        if(isTransactionCheck()) {
        printMsg(Logger.WARNING, "DO without transaction context is created : Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
        (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

        }
    }

</xsl:if>
    /**
     * Protected constructor.  Only derived classes should call it.
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO ()
    throws ObjectIdException, DatabaseManagerException {
        super( notUsingOId );
        get_DataStruct().set_Database(get_logicalDBName());
        if(isTransactionCheck()) {
            printMsg(Logger.WARNING, "DO without transaction context is created : Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
            (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

        }
        if (autoSaveAllowed&&isAutoSaveCreateVirgin()&&null != transaction) {
            try {
                save(transaction,false);
            } catch (Exception ex) {
                printMsg(Logger.DEBUG,"Failed to AutoSave virgin DO: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class\n");
            }
        }
    }

    /**
     * Protected constructor.  Only derived classes should call it.
     * @param dbTrans The current database transaction.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO (DBTransaction dbTrans)
    throws ObjectIdException, DatabaseManagerException {
        super( notUsingOId );
        setTransaction(dbTrans);
        String originDatabase = null;
        if(dbTrans!=null) {
           originDatabase = dbTrans.getDatabaseName();
        }
        if(originDatabase==null)
           originDatabase = get_logicalDBName();<xsl:if test="DO_IS_MULTIDB_BASED='true'">
        else {
            if(useLogicalDatabase(originDatabase)) {
             try {
               readCacheConfiguration(originDatabase);
            } catch (Exception ex) {
              printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+originDatabase+"' database");
          }
         }
        }    </xsl:if>
        get_DataStruct().set_Database(originDatabase);
<xsl:if test="DO_IS_OID_BASED='true'">
</xsl:if>
        addToTransactionCache(this, dbTrans);
        if (autoSaveAllowed&&isAutoSaveCreateVirgin()&&null != transaction) {
            try {
                save(transaction,false);
            } catch (Exception ex) {
                printMsg(Logger.DEBUG,"Failed to AutoSave virgin DO: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class\n");
            }
        }
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'">
    /**
     * Protected constructor. Only derived classes should call it.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO (String dbName)
    throws ObjectIdException, DatabaseManagerException {
        super(dbName,notUsingOId);
        if (dbName == null)
            dbName = get_OriginDatabase();
        if(useLogicalDatabase(dbName)) {
          try {
            readCacheConfiguration(dbName);
         } catch (Exception ex) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+dbName+"' database");
         }
        }
        get_DataStruct().set_Database(dbName);
<xsl:if test="DO_IS_OID_BASED='true'">
</xsl:if>
        if(isTransactionCheck()) {
           printMsg(Logger.WARNING, "DO without transaction context is created : Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
           (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));
        }
        if (autoSaveAllowed&&isAutoSaveCreateVirgin()&&null != transaction) {
            try {
                save(transaction,false);
            } catch (Exception ex) {
                printMsg(Logger.DEBUG,"Faild to AutoSave virgin DO: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class\n");
            }
        }
    }
</xsl:if>

    /**
     * isLoaded()
     * Returns information whether object's data is loaded from database.
     * @return true if the data for this object has been retrieved
     * from the database.
     */
    public boolean isLoaded() {
        return (null != originalData)&&(!get_DataStruct().isEmpty());
    }

<xsl:if test="DO_IS_OID_BASED='true'">
    /**
     * Load the fields for the DO from the database.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    public void loadData()
    throws SQLException, ObjectIdException, DataObjectException {
        if (null == originalData&&!get_DataStruct().isEmpty()) {
            originalData = new <xsl:value-of select="CLASS_NAME"/>DataStruct ();
        }
<xsl:if test="IS_ABSTRACT='false'">
        ObjectId id = get_OId();
        if ( null == id )
            return;
        if ( ! isPersistent() )   // DO from createVirgin
            return;
        // DO from createExisting.  Complain if no record in database.
        <xsl:value-of select="CLASS_NAME"/>Query query;
<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
        try {</xsl:if>
            if(get_transaction()!=null)
                query = new <xsl:value-of select="CLASS_NAME"/>Query (get_transaction());
            else {<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
              if (get_OriginDatabase() != null)
                query = new <xsl:value-of select="CLASS_NAME"/>Query (get_OriginDatabase());
              else</xsl:if></xsl:if>
               query = new <xsl:value-of select="CLASS_NAME"/>Query (get_transaction());
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
          }<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
        } catch (DatabaseManagerException e) {
            throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
        }
</xsl:if></xsl:if>
        query.setQueryOId( id );
        query.requireUniqueInstance();
        <xsl:value-of select="CLASS_NAME"/>DO obj;
        try {
           query.setLoadData(true);
           obj = query.getNextDO();
            if ( null == obj )
                throw new DataObjectException("<xsl:value-of select="CLASS_NAME"/>DO DO not found for id=" + id );
            makeIdentical(obj);
            //set_Version(    obj.get_Version() );
            //get_DataStruct().set_Empty(false);
        } catch ( NonUniqueQueryException e ) {
            throw new ObjectIdException( "Duplicate ObjectId" );
        }
</xsl:if>
    }
</xsl:if>

    /**
     * Protected constructor used by createExisting(ObjectId) above.
     *
     * @param id The ObjectId for the object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   Should never see this exception since GenericDO.ctor(ObjectId)
     *   never accesses the database.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO( ObjectId id )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        super( id );
        get_DataStruct().set_Database(get_logicalDBName());
        if(isTransactionCheck()) {
           printMsg(Logger.WARNING, "DO without transaction context is created : Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
           (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));
        }
    }

    /**
     * Protected constructor used by createExisting(ObjectId, DBTransaction) above.
     *
     * @param id The ObjectId for the object.
     * @param dbTrans The current database transaction
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   Should never see this exception since GenericDO.ctor(ObjectId)
     *   never accesses the database.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO( ObjectId id , DBTransaction dbTrans)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        super( id );
        setTransaction(dbTrans);
        String originDatabase = null;
        if(dbTrans!=null) {
           originDatabase = dbTrans.getDatabaseName();
        }
        if(originDatabase==null)
           originDatabase = get_logicalDBName();<xsl:if test="DO_IS_MULTIDB_BASED='true'">
        else {
           if(useLogicalDatabase(originDatabase)) {
             try {
               readCacheConfiguration(originDatabase);
            } catch (Exception ex) {
               printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+originDatabase+"' database");
            }
         }
        } </xsl:if>
        get_DataStruct().set_Database(originDatabase);
        addToTransactionCache(this, dbTrans);
    }


<xsl:if test="DO_IS_MULTIDB_BASED='true'">
    /**
     * Protected constructor used by createExisting(dbName,ObjectId) above.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param id The ObjectId for the object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   Should never see this exception since GenericDO.ctor(ObjectId)
     *   never accesses the database.
     */
    protected <xsl:value-of select="CLASS_NAME"/>DO(String dbName, ObjectId id )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        super(dbName,id);
        if (dbName == null)
            dbName = get_OriginDatabase();
        if(useLogicalDatabase(dbName)) {
          try {
             readCacheConfiguration(dbName);
          } catch (Exception ex) {
             printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '"+dbName+"' database");
          }
         }
        get_DataStruct().set_Database(dbName);
        if(isTransactionCheck()) {
            printMsg(Logger.WARNING, "DO without transaction context is created : Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
            (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

        }
    }

</xsl:if>
<xsl:if test="IS_ABSTRACT='false'">

    /**
     * Represents table and cache (if there is caching) statistics.
     */
    protected static Statistics statistics;

    /**
     * Get table statistics.
     *
     * @return Table statistics.
     */
    public static Statistics get_statistics() {
        statistics = cache.getStatistics();
        return statistics;
    }

    /**
     * Refresh table statistics.
     */
    public static void refreshStatistics() {
       cache.refreshStatistics();
    }
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
    /**
     * This set contains list of logical databases used by this <xsl:value-of select="CLASS_NAME"/>DO.
     */
    protected static HashSet usedDatabase;

    /**
     * Add logical database in set of used logical databases. Set of this databases is important for
     * refreshing cache in full caching mode. Tables from this databases will be refreshed.
     * This method returns information whether database already exists in set usedDatabase.
     *
     * @return True if database does not already exist in database set, otherwise false.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static synchronized boolean useLogicalDatabase(String database)
    throws DatabaseManagerException, ObjectIdException {
        if (database == null)
            database = get_logicalDBName();
        if (usedDatabase == null)
            usedDatabase = new HashSet();
        boolean result = usedDatabase.add(database);
        if (result && cache != null && cache.isFull() && isFullCacheNeeded) {
            //JP 2007-10-09 - moved tmpTrans.release() to finally block
            DBTransaction tmpTrans = null;
            try {<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                <xsl:value-of select="CLASS_NAME"/>Query query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if>
<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                <xsl:value-of select="CLASS_NAME"/>Query query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans);</xsl:if>
                query.hitDatabase();
                <xsl:value-of select="CLASS_NAME"/>DO obj;
                <xsl:value-of select="CLASS_NAME"/>DataStruct objData;
                while ( null != ( obj = query.getNextDO() ) ) {
                    objData = (<xsl:value-of select="CLASS_NAME"/>DataStruct)obj.originalData_get();
                    if (objData != null) {
                       /*objData = */addToCache( objData );
                    }
                } <xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                // JP 2007-10-09 - moved tmpTrans.release() to finally block
                //tmpTrans.release();
                </xsl:if>
              } catch (DataObjectException e) {
                throw new DatabaseManagerException("INTERNAL ERROR: unexpected DataObjectException", e);<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
             } catch (SQLException e) {
                throw new DatabaseManagerException("INTERNAL ERROR: error in creating transaction", e); </xsl:if>
            } catch ( NonUniqueQueryException ex ) {
              throw new ObjectIdException( "Duplicate ObjectId" );
            }
            // JP 2007-10-09 - moved tmpTrans.release() to finally block
            finally {
                if (tmpTrans != null) {
                    tmpTrans.release();
                }
            }    
        }
        return result;
    }

    /**
     * Get all used logical databases.
     *
     * @deprecated Use get_UsedLogicalDatabases()
     * @return Array that contains names of all used logical databases.
     *
     */
    public static String[] getUsedLogicalDatabases() {
        return get_UsedLogicalDatabases();
    }

    /**
     * Get all used logical databases.
     *
     * @return Array that contains names of all used logical databases.
     *
     */
    public static String[] get_UsedLogicalDatabases() {
        if (usedDatabase != null)
            return (String[])usedDatabase.toArray();
        return null;
    }

</xsl:if>

<xsl:if test="DO_IS_MULTIDB_BASED='false'">

    /**
     * Get all used logical databases.
     *
     * @deprecated Use get_UsedLogicalDatabases()
     * @return Array that contains names of all used logical databases.
     *
     */
    public static String[] getUsedLogicalDatabases() {
        return get_UsedLogicalDatabases();
    }

    /**
     * Get all used logical databases.
     *
     * @return Array that contains names of all used logical databases.
     *
     */
    public static String[] get_UsedLogicalDatabases() {
        String[] str = { get_logicalDBName() };
        return str;
    }</xsl:if>


    protected static DataStructCache cache; // cache for <xsl:value-of select="CLASS_NAME"/>DO


    protected static boolean isFullCacheNeeded = false; // it depends on CacheFullCacheCountLimit parameter and number of data in database.



    /**
     * Read cache configuration from application configuration file:
     * cache size for <xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="TABLE_NAME"/> table or default cache size.
     * @param database DO's database.
     * @exception CacheObjectException
     */
    public static void readCacheConfiguration(String database) throws CacheObjectException {
        if (getConfigurationAdministration().isDisabled()) {
            throw new CacheObjectException("Caching is disabled");
        }
        Config tableConfig = null;
        Config cacheConfig = null;
        try {
            tableConfig = (Config)DODS.getDatabaseManager().getConfig().getSection("DB."+database+".<xsl:value-of select="TABLE_NAME"/>");
        } catch (Exception ex) {
             printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default configuration for '<xsl:value-of select="TABLE_NAME"/>' table");
        }
        try {
            cacheConfig = (Config)DODS.getDatabaseManager().getConfig().getSection("DB."+database+".<xsl:value-of select="TABLE_NAME"/>.cache");
        } catch ( Exception e ) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" Using default cache configuration for '<xsl:value-of select="TABLE_NAME"/>' table");
        }
        <xsl:if test="DO_IS_MULTIDB_BASED='true'"></xsl:if>
        cache.readConfiguration(tableConfig,cacheConfig, database);
    }
    /**
     * Returns information if asynchronous cache initialization is needed or not.
     *
     * @return true if asynchronous cache initialization is needed,
     * otherwise false.
     */
    public static boolean isAsynchCacheLoadNeeded() { // tj added 25.02.2006
      return asynchCacheLoadNeeded;
    }
   
    /**
     * Returns priority for asynchronous cache initialization.
     * If asynchronous cache initialization is not needed, method returns
     * value -1.
     *
     * @return priority for asynchronous cache initialization.
     */
    public static int getAsynchLoadPriority() { // tj added 25.02.2006
      //if isAsynchCacheLoadNeeded()
        return cache.getAsynchLoadPriority();
      //else
      //  return -1;
    }

     /**
     * Returns information if simple cache is used or not.
     *
     * @return true if simple cache is used, otherwise false.
     */
    public static boolean isSimpleCacheUsed() { // tj added 07.07.2006
        return simpleCacheUsed;
    }

    /**
     * Get name of the table that is cached.
     *
     * @return Name of the table that is cached.
     */
    public static String getCacheDodsTableName() {
        return "<xsl:value-of select="TABLE_NAME"/>";
    }


    /**
     * Returns <xsl:value-of select="TABLE_NAME"/> table cache.
     *
     * @return <xsl:value-of select="TABLE_NAME"/> table cache.
     */
    public static ConfigurationAdministration getConfigurationAdministration() {
        return cache;
    }

    protected static String __tmln;

    protected static boolean __beginTx(String ldb) {
        try {
            javax.transaction.TransactionManager tm;
            if ((DODS.getDatabaseManager().getConfig().getBoolean("DB." + ldb + ".JTA",
                                                                  DODS.getDatabaseManager()
                                                                      .getConfig()
                                                                      .getBoolean("defaults.JTA",
                                                                                  false)))) {
                if (null == __tmln) {
                    DatabaseConfiguration lDbConf = ((StandardLogicalDatabase) DODS.getDatabaseManager()
                        .findLogicalDatabase(ldb)).getDatabaseConfiguration();
                    __tmln = lDbConf.getXaTransactionManagerLookupName();
                }
                tm = (javax.transaction.TransactionManager) new javax.naming.InitialContext().lookup(__tmln);
                if (null != tm && javax.transaction.Status.STATUS_NO_TRANSACTION == tm.getStatus()) {
                    tm.setTransactionTimeout(80*60);
                    tm.begin();
                    return true;
                }
            }
        } catch (Exception _) {
            DODS.getLogChannel().write(Logger.WARNING, "", _);
        }
        return false;
    }

    protected static void __endTx() {
        try {
            javax.transaction.TransactionManager tm = (javax.transaction.TransactionManager) new javax.naming.InitialContext().lookup(__tmln);
            tm.commit();
        } catch (Exception _) {
            DODS.getLogChannel().write(Logger.WARNING, "", _);
        }
    }

    /**
     * Queries all rows in table, and for each row
     * creates a DO instance in the cache.
     * For these DOs, data.readOnly = true,
     * which causes set methods to throw an exception.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    public static void refreshCache()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {
        boolean localTx = false;
        try {
            localTx = __beginTx(get_logicalDBName());
            DODS.getLogChannel().write(Logger.DEBUG, "REFRESH cache started utx:"+localTx);
            __refreshCache();
        } finally {
            if (localTx) {
                __endTx();
            }
        }
    }

    private static void __refreshCache()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {
       getConfigurationAdministration().getCacheAdministration(CacheConstants.DATA_CACHE).refresh();
       String querySnt = cache.getInitialQueryCache();
       int maxSize = cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize();
        // tj 07.07.2006. begin
        int queryTimeoutCacheInit = cache.getQueryTimeoutCacheInit();
        int queryTimeLimitCacheInit = cache.getQueryTimeLimitCacheInit();
        int maxExecuteTimeCacheInit = cache.getMaxExecuteTimeCacheInit(); // tj 07.07.2006. end
                         if (maxSize != 0) {
                cache.checkFull();
           if(cache.isFull()) {
           if(cache.getTableConfiguration().getFullCacheCountLimit() == 0) {
               isFullCacheNeeded=false;
           } else if(cache.getTableConfiguration().getFullCacheCountLimit() > 0) {
            int numOfRows = 0;
             <xsl:value-of select="CLASS_NAME"/>Query query;
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    if (usedDatabase != null) {
                    //JP 2007-10-09 - moved tmpTrans.release() to finally block
                    DBTransaction tmpTrans = null;
                        try {
                            String database;
                            for (Iterator i = usedDatabase.iterator(); i.hasNext();) {
                                database = (String)i.next();<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if><xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans); </xsl:if>
                                        if (queryTimeoutCacheInit > 0)                        
                                                query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                        if (queryTimeLimitCacheInit > 0)
                                        query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                        if (maxExecuteTimeCacheInit > 0)
                                        query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                                <xsl:value-of select="CLASS_NAME"/>DO obj;
                                numOfRows = query.getCount();<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                // JP 2007-10-09 - moved tmpTrans.release() to finally block
                            //tmpTrans.release();
                            </xsl:if>
                            }
                        } catch (DatabaseManagerException e) {
                            throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                    // JP 2007-10-09 - moved tmpTrans.release() to finally block
                    finally {
                        if (tmpTrans != null) {
                            tmpTrans.release();
                        }
                    }    
                    } else {
</xsl:if>
                DBTransaction tmpTransaction = null;
                try {
                                    tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
                                _tr_(tmpTransaction).getTransactionCache().getCacheContent().clear();
                query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTransaction);  
    if (queryTimeoutCacheInit > 0)                        
                                        query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                if (queryTimeLimitCacheInit > 0)
                            query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                        try {
                            numOfRows = query.getCount();
                        //JP 2007-10-09 - Moved to finally block
                            //tmpTransaction.release();
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                }
                //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                finally {
                    if (tmpTransaction != null) {
                        tmpTransaction.release();
                    }
                }
        <xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    }</xsl:if>

               if (numOfRows < cache.getTableConfiguration().getFullCacheCountLimit())
                  isFullCacheNeeded = true;
               else
                  isFullCacheNeeded = false;

           } else
               isFullCacheNeeded=true;
                }
                if (querySnt != null) {
                    <xsl:value-of select="CLASS_NAME"/>Query query;
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    if (usedDatabase != null) {
                    //JP 2007-10-09 - Moved to finally block
                    DBTransaction tmpTrans = null;
                        try {
                            String database;
                            for (Iterator i = usedDatabase.iterator(); i.hasNext();) {
                                database = (String)i.next();<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if><xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans); </xsl:if>
            if (queryTimeoutCacheInit > 0)                        
                                                query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                        if (queryTimeLimitCacheInit > 0)
                            query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                        if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                                query.hitDatabase();
// tj 02.04.2004                        maxSize = cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize();
            int initMaxSize = 0;
                                            if(cache.getInitialDSCacheSize()> 0){
                                                            initMaxSize=cache.getInitialDSCacheSize();
                                                     }
                                                    if((initMaxSize > 0) && ((initMaxSize < maxSize)||(maxSize < 0))) {
                                                       isFullCacheNeeded = false;
                              maxSize=initMaxSize;
                           }

                                if (maxSize > 0)
                                    query.setMaxRows(maxSize);
                                if (!querySnt.equals("*")) {
                                    QueryBuilder builder = query.getQueryBuilder();
                                    builder.addWhere(querySnt);
                                }
//                        <xsl:value-of select="CLASS_NAME"/>DO obj;
                      if (cache.getInitialCacheFetchSize()>0){
                              query.set_FetchSize(cache.getInitialCacheFetchSize());
                              }

                                query.set_CursorType(cache.getTableConfiguration().getInitCachesResultSetType(),cache.getTableConfiguration().getInitCachesResultSetConcurrency());
                                   query.setLoadData(true);
                                   query.getNextDO();<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                               //JP 2007-10-09 - Moved to finally block
                                   //tmpTrans.release();</xsl:if>
                            }
                        } catch (DatabaseManagerException e) {
                            throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                    //JP 2007-10-09 - Moved tmpTrans.release() to finally block
                    finally {
                        if (tmpTrans != null) {
                            tmpTrans.release();
                        }
                    }
                    } else {
</xsl:if>
                DBTransaction tmpTransaction = null;
                try {
                         tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
                        _tr_(tmpTransaction).getTransactionCache().getCacheContent().clear();
                        query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTransaction);
    if (queryTimeoutCacheInit > 0)                        
                                        query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                if (queryTimeLimitCacheInit > 0)
                            query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                        query.hitDatabase();
// tj 02.04.2004                maxSize = cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize();
                                        int initMaxSize = 0;
                                        if(cache.getInitialDSCacheSize()> 0){
                                                initMaxSize=cache.getInitialDSCacheSize();
                                        }
                                        if((initMaxSize > 0) && ((initMaxSize < maxSize)||(maxSize < 0))) {
                                           isFullCacheNeeded = false;
                  maxSize=initMaxSize;
               }
                        if (maxSize > 0)
                            try {
                                query.setMaxRows(maxSize);
                            }
                            catch (NonUniqueQueryException nuEx){
                                System.err.println ("NonUniqueQueryException in refreshCache() method : too many rows were      found.");
                            }
                        if (!querySnt.equals("*")) {
                            QueryBuilder builder = query.getQueryBuilder();
                            builder.addWhere(querySnt);
                        }
//                <xsl:value-of select="CLASS_NAME"/>DO obj;
                        try {
                        if (cache.getInitialCacheFetchSize()>0){
                        query.set_FetchSize(cache.getInitialCacheFetchSize());
                        }
                        query.set_CursorType(cache.getTableConfiguration().getInitCachesResultSetType(),cache.getTableConfiguration().getInitCachesResultSetConcurrency());
                            query.setLoadData(true);
                            query.getNextDO();
                        //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                            //tmpTransaction.release();
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                }
                //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                finally {
                    if (tmpTransaction != null) {
                        tmpTransaction.release();
                    }
                }
        <xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    }</xsl:if>
                }
             }
             cache.refreshStatistics();
             asynchCacheLoadNeeded = false;
    }

    private static boolean isDisabledCaching = false;

    /**
     * Disable caching.
     * @exception java.sql.SQLException
     * @exception DatabaseManagerException
     * @exception ObjectIdException
     * @exception DataObjectException
     */
    public static void disableCaching()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {
        isDisabledCaching = true;
        getConfigurationAdministration().getCacheAdministration(CacheConstants.DATA_CACHE).disable();
    }

    /**
     * Enable caching.
     * @exception java.sql.SQLException
     * @exception DatabaseManagerException
     * @exception ObjectIdException
     * @exception DataObjectException
     */
    public static void enableCaching()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {
        boolean localTx = false;
        try {
            localTx = __beginTx(get_logicalDBName());
            DODS.getLogChannel().write(Logger.DEBUG, "ENABLE cache started utx:"+localTx);
            __enableCaching();
        } finally {
            if (localTx) {
                __endTx();
            }
        }
    }

    public static void __enableCaching()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {
        if (isDisabledCaching){
            getConfigurationAdministration().getCacheAdministration(CacheConstants.DATA_CACHE).enable();
            int maxSize = cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize();

            // tj 07.07.2006. begin
                int queryTimeoutCacheInit = cache.getQueryTimeoutCacheInit();
                int queryTimeLimitCacheInit = cache.getQueryTimeLimitCacheInit();
                int maxExecuteTimeCacheInit = cache.getMaxExecuteTimeCacheInit(); // tj 07.07.2006. end

            if (maxSize != 0){
           if(cache.isFull()) {
           if(cache.getTableConfiguration().getFullCacheCountLimit() == 0) {
               isFullCacheNeeded=false;
           } else if(cache.getTableConfiguration().getFullCacheCountLimit() > 0) {
            int numOfRows = 0;
             <xsl:value-of select="CLASS_NAME"/>Query query;
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    if (usedDatabase != null) {
                    //JP 2007-10-09 - Moved to finally block
                    DBTransaction tmpTrans = null;
                        try {
                            String database;
                            for (Iterator i = usedDatabase.iterator(); i.hasNext();) {
                                database = (String)i.next();<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if><xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                                query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans); </xsl:if>
            if (queryTimeoutCacheInit > 0)                        
                                                query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                        if (queryTimeLimitCacheInit > 0)
                            query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                        if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                                <xsl:value-of select="CLASS_NAME"/>DO obj;
                                numOfRows = query.getCount();<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                            //JP 2007-10-09 - Moved to finally block
                                //tmpTrans.release();</xsl:if>
                            }
                        } catch (DatabaseManagerException e) {
                            throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                    //JP 2007-10-09 - Moved tmpTrans.release() to finally block
                    finally {
                        if (tmpTrans != null) {
                            tmpTrans.release();
                        }
                    }
                    } else {
</xsl:if>
                DBTransaction tmpTransaction = null;
                try {
                        tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
                        _tr_(tmpTransaction).getTransactionCache().getCacheContent().clear();
                        query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTransaction);
    if (queryTimeoutCacheInit > 0)                        
                                        query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                if (queryTimeLimitCacheInit > 0)
                            query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                        try {
                            numOfRows = query.getCount();
                        //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                            //tmpTransaction.release();
                        } catch ( NonUniqueQueryException ex ) {
                            // Since we do not call query.requireUniqueInstance()
                            // this should never happen.
                            throw new ObjectIdException( "Duplicate ObjectId" );
                        }
                }
                //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                finally {
                    if (tmpTransaction != null) {
                        tmpTransaction.release();
                    }
                }
        <xsl:if test="DO_IS_MULTIDB_BASED='true'">
                    }</xsl:if>

               if (numOfRows < cache.getTableConfiguration().getFullCacheCountLimit())
                  isFullCacheNeeded = true;
               else
                  isFullCacheNeeded = false;

           } else
               isFullCacheNeeded=true;
                }

            String querySnt = cache.getInitialQueryCache();
            if (querySnt != null) {
                        <xsl:value-of select="CLASS_NAME"/>Query query;
            <xsl:if test="DO_IS_MULTIDB_BASED='true'">
                        if (usedDatabase != null) {
                        DBTransaction tmpTrans = null;
                            try {
                                String database;
                                for (Iterator i = usedDatabase.iterator(); i.hasNext();) {
                               database = (String)i.next();<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                          query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if><xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                    tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                                    query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans); </xsl:if>
                    if (queryTimeoutCacheInit > 0)                        
                                                        query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                                if (queryTimeLimitCacheInit > 0)
                                    query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                                if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                                    query.hitDatabase();
                  int initMaxSize = 0;
                                                        if(cache.getInitialDSCacheSize()> 0){
                                                                  initMaxSize=cache.getInitialDSCacheSize();
                                                        }
                                                        if((initMaxSize > 0) && ((initMaxSize < maxSize)||(maxSize<0))){
                                                          isFullCacheNeeded = false;
                                 maxSize=initMaxSize;
                               }

                               if (maxSize > 0)
                                         query.setMaxRows(maxSize);
                                  if (cache.getInitialCacheFetchSize()>0){
                                                                         query.set_FetchSize(cache.getInitialCacheFetchSize());
                                                                       }
                                                                       query.set_CursorType(cache.getTableConfiguration().getInitCachesResultSetType(),cache.getTableConfiguration().getInitCachesResultSetConcurrency());
                                    query.setLoadData(true);
                                    if (!querySnt.equals("*")) {
                                        QueryBuilder builder = query.getQueryBuilder();
                                        builder.addWhere(querySnt);
                                    }
                                    <xsl:value-of select="CLASS_NAME"/>DO obj;
                                    query.getNextDO();<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                                //JP 2007-10-09 - Moved tmpTrans.release() to finally block
                                    //tmpTrans.release();
                                </xsl:if>
                                }
                            } catch (DatabaseManagerException e) {
                                throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
                            } catch ( NonUniqueQueryException ex ) {
                                // Since we do not call query.requireUniqueInstance()
                                // this should never happen.
                                throw new ObjectIdException( "Duplicate ObjectId" );
                            }
                        //JP 2007-10-09 - Moved tmpTrans.release() to finally block
                        finally {
                            if (tmpTrans != null) {
                                tmpTrans.release();
                            }
                        }
                        } else {
            </xsl:if>
                    //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                    DBTransaction tmpTransaction = null;
                    try {
                       tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
                       _tr_(tmpTransaction).getTransactionCache().getCacheContent().clear();
                       query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTransaction);
                                        if (queryTimeoutCacheInit > 0)                        
                                                query.set_QueryTimeout(queryTimeoutCacheInit); // tj 07.07.2006.
                                        if (queryTimeLimitCacheInit > 0)
                                    query.setQueryTimeLimit(queryTimeLimitCacheInit); // tj 07.07.2006.
                                        if (maxExecuteTimeCacheInit > 0)
                            query.setMaxExecuteTime(maxExecuteTimeCacheInit); // tj 07.07.2006.
                            query.hitDatabase();
            int initMaxSize = 0;
          if(cache.getInitialDSCacheSize()> 0){
                                  initMaxSize=cache.getInitialDSCacheSize();
                                                 }
                                                 if((initMaxSize > 0) && ((initMaxSize < maxSize)||(maxSize < 0))){
                                                    isFullCacheNeeded = false;
                           maxSize=initMaxSize;
                        }

                      if (maxSize > 0)
                             try {
                                query.setMaxRows(maxSize);
                             }
                             catch (NonUniqueQueryException nuEx){
                                System.out.println ("NonUniqueQueryException in enableCache() method : too many rows were found.");
                             }

                            if (!querySnt.equals("*")) {
                                QueryBuilder builder = query.getQueryBuilder();
                                builder.addWhere(querySnt);
                            }
//                    <xsl:value-of select="CLASS_NAME"/>DO obj;
                            try {
                                if (cache.getInitialCacheFetchSize()>0){
                                                                query.set_FetchSize(cache.getInitialCacheFetchSize());
                                                        }
                                                        query.set_CursorType(cache.getTableConfiguration().getInitCachesResultSetType(),cache.getTableConfiguration().getInitCachesResultSetConcurrency());
                                query.setLoadData(true);
                                query.getNextDO();
                            //JP 2007-10-09 - Moved tmpTransaction.release() to finally block
                                //tmpTransaction.release();
                            } catch ( NonUniqueQueryException ex ) {
                                // Since we do not call query.requireUniqueInstance()
                                // this should never happen.
                                throw new ObjectIdException( "Duplicate ObjectId" );
                            }
                    }
                    //JP 2007-10-09 - Moved tmpTrans.release() to finally block
                    finally {
                        if (tmpTransaction != null) {
                            tmpTransaction.release();
                        }
                    }
            <xsl:if test="DO_IS_MULTIDB_BASED='true'">
                        }</xsl:if>
                    }
                 }
              asynchCacheLoadNeeded = false;
        }
    }

    /* *
     * Add DO to cache.
     * If DO already exists in cache, just the data member is replaced,
     * so that application references to the DO remain valid.
     * If there  is no caching newDO object is returned.
     *
     * @param newDO Data object that will be added to cache.
     * @return Data object added to cache.
     * /
    private <xsl:value-of select="CLASS_NAME"/>DO addToTransactionCache( <xsl:value-of select="CLASS_NAME"/>DO newDO ) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        if(get_transaction()!=null && _tr_(get_transaction()).getTransactionCache()!=null) {
            ret = (<xsl:value-of select="CLASS_NAME"/>DO)_tr_(get_transaction()).getTransactionCache().addDO(newDO);
        }
        if (ret == null)
            return newDO;
        return ret;
    }*/

    /**
     * Add DataStruct object to cache.
     * If there is no caching newDO object is returned.
     *
     * @param newDS DataStruct object that will be added to cache.
     * @return DataStruct object added to cache.
     */
    public static synchronized <!--<xsl:value-of select="CLASS_NAME"/>DataStruct-->void addToCache(<xsl:value-of select="CLASS_NAME"/>DataStruct newDS) {
        if (newDS.isEmpty() && cache.isFull() && isFullCacheNeeded) {
            Error err = new Error("empty DS");
            DODS.getLogChannel().write(Logger.ERROR, newDS.toString(), err);
            throw err;
        }
        if (!newDS.readOnly) {
            Error err = new Error("not read only goes to Hollywood");
            DODS.getLogChannel().write(Logger.ERROR, newDS.toString(), err);
            throw err;
        }
        cache.addDataStruct(newDS);
<!--         if (ret == null)
        <xsl:value-of select="CLASS_NAME"/>DataStruct ret = (<xsl:value-of select="CLASS_NAME"/>DataStruct)cache.addDataStruct(newDS);
            return newDS;
        return ret;
 -->    }

    /**
     * Add DO's original data object to cache.
     */
    public void addToCache() {
        addToCache((<xsl:value-of select="CLASS_NAME"/>DataStruct)this.originalData_get());
    }

    /* *
     * Add DO to cache.
     * If DO already exists in cache, just the data member is replaced,
     * so that application references to the DO remain valid.
     * This method overides method addToCache of the class CoreDO.
     * /
    private void addToTransactionCache() {
        addToTransactionCache(this);
    }*/


     /**
     * UpdateCache for given DataStruct object.
     *
     * @param updDS DataStruct object
     * @return Updated or inserted DataStruct object.
     */
    public static synchronized <xsl:value-of select="CLASS_NAME"/>DataStruct updateCache( <xsl:value-of select="CLASS_NAME"/>DataStruct updDS) {
        <xsl:value-of select="CLASS_NAME"/>DataStruct ret = (<xsl:value-of select="CLASS_NAME"/>DataStruct)cache.updateDataStruct(updDS);
        if (ret == null)
            return updDS;
        return ret;
    }

    /**
     * Update Cache.
     */
    public void updateCache() {
        updateCache((<xsl:value-of select="CLASS_NAME"/>DataStruct)this.originalData_get());
    }

    /**
     * Delete DataStruct object from cache
     *
     * @param data DataStruct object for deleting
     *
     * @return Deleted DataStruct object
     */
    public static synchronized <xsl:value-of select="CLASS_NAME"/>DataStruct deleteFromCache( <xsl:value-of select="CLASS_NAME"/>DataStruct data ) {
        cache.deleteDataStruct(data);
        return data;
    }


    /**
     * Remove DataStruct object from cache.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DataStruct object will be removed.
     * @param handle Handle of DataStruct object which will be re moved.
     */
    public static synchronized void removeFromCache(String dbName, String handle) {
        String cacheHandle = dbName+"."+tableName+"."+handle;
        cache.removeDataStruct( cacheHandle );
    }

    /**
     * Delete object from cache
     */
    public void deleteFromCache() {
        deleteFromCache((<xsl:value-of select="CLASS_NAME"/>DataStruct)this.originalData_get());
    }


    /**
     * Remove DataStruct from cache.
     *
     * @param data DataStruct object which will be removed.
     *
     * @return Removed DataStruct object or null if DataStruct object doesn't
     * exist in the cache.
     */
    public static synchronized <xsl:value-of select="CLASS_NAME"/>DataStruct removeFromCache( <xsl:value-of select="CLASS_NAME"/>DataStruct data ) {
        return (<xsl:value-of select="CLASS_NAME"/>DataStruct)cache.removeDataStruct(data);
    }

    /**
     * Remove DataStruct from cache.
     */
    public void evict() {
        if (!isPersistent())
            removeFromCache((<xsl:value-of select="CLASS_NAME"/>DataStruct)this.originalData_get());
    }

    /**
     * Remove DataStruct objects from cache.
     *
     * @param DSs Array of DataStruct objects which will be removed from cache.
     */
    public static void evict(<xsl:value-of select="CLASS_NAME"/>DataStruct[] DSs) {
        for (int i=0; i<DSs.length; i++)
            removeFromCache(/*(<xsl:value-of select="CLASS_NAME"/>DataStruct)*/ DSs[i]);
    }

    /**
     * Remove DataStruct objects from cache.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DataStruct object will be removed.
     * @param handles array of DataStruct object handles that will be removed
     * from cache.
     */
    public static void evict(String dbName, String[] handles) {
        if (handles!=null) {
            for (int i=0; i<handles.length; i++)
                removeFromCache(dbName, handles[i]);
        }
    }

    /**
     * logicalDbName is logical database name
     * set by setLogicalDBName()
     * and retrieved by get_logicalDBName().
     */
    static private String logicalDbName/* = null*/;

    /**
     * DriverDependencies instance helps to overcome non standard
     * solutions implemented by some JDBC drivers.
     *
     */
    static org.enhydra.dods.DriverDependencies tweak;

    /**
     * The cache is used automatically by the class.
     * Callers of the create() methods do not know whether
     * the returned DO instance is shared or not.
     * This prevents the existence of multiple instances in memory
     * of the same database object.
     * The cache is instantiated when the first DO instance is created.
     */

    /**
     * Class that contains unchanging (static) data from the database
     * will have a cache of DOs representing the entire contents of the table.
     */
    static {
        try {
            Method m = Class.forName("org.enhydra.dods.dbtransaction.ExtendedTxFactory").getMethod("registerDO",new Class[]{String.class,String.class,new String[] {}.getClass(),new String[] {}.getClass()});
            m.invoke(null,new Object[]{"<xsl:value-of select="TABLE_NAME"/>","<xsl:value-of select="PACKAGE"/>.<xsl:value-of select="CLASS_NAME"/>DO", new String[] {
<xsl:for-each select="//REFERRER">                    "<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>DO",
</xsl:for-each>                }, new String[] {
<xsl:for-each select="//COLUMN"><xsl:if test="REFERENCE_OBJECT/IS_FOREIGN_KEY='false'">                    "<xsl:value-of select="JAVA_TYPE"/>",
</xsl:if></xsl:for-each>                }});
        } catch (ClassNotFoundException e) {
             //System.err.println("Oops!"+e);
        } catch (IllegalAccessException e) {
             System.err.println("Oops!"+e);
        } catch (java.lang.reflect.InvocationTargetException e) {
             System.err.println("Oops!"+e);
        } catch (IllegalArgumentException e) {
             System.err.println("Oops!"+e);
        } catch (SecurityException e) {
             //System.err.println("OK!"+e);
        } catch (NoSuchMethodException e) {
             //System.err.println("OK!"+e);
        }
        try {
            logicalDbName = DODS.getDatabaseManager().getDefaultDB();
                        String dbName = logicalDbName;

                        useBinaryStreamForLongvarchar = DriverSpecificConstants.DEFAULT_USE_BINARY_STREAM_FOR_LONGVARCHAR;
                        try {
                                String useBinaryStreamStr = ((StandardLogicalDatabase)DODS.getDatabaseManager()
                                                          .findLogicalDatabase(dbName)).getDriverProperty(DriverSpecificConstants.PARAMNAME_USE_BINARY_STREAM_FOR_LONGVARCHAR);
                                if(useBinaryStreamStr!=null){
                                        if(useBinaryStreamStr.equalsIgnoreCase("true")){
                                                useBinaryStreamForLongvarchar=true;
                                        }else if(useBinaryStreamStr.equalsIgnoreCase("false")){
                                                useBinaryStreamForLongvarchar=false;
                                        }else{
                                                printMsg(Logger.DEBUG,"<xsl:value-of select="CLASS_NAME"/>DO : Illegal value for UseBinaryStreamForLongarchar parameter. Using default. ");
                                        }
                                }
                        } catch (DatabaseManagerException e){
                                printMsg(Logger.DEBUG,"<xsl:value-of select="CLASS_NAME"/>DO : Unable to read configuration for UseBinaryStreamForLongarchar. Using default. ");
                        }

                        useOrderedWithTable = null;
                        try {
                                String orderedResultSetStr = ((StandardLogicalDatabase)DODS.getDatabaseManager()
                                                          .findLogicalDatabase(dbName)).getDriverProperty(Common.VENDOR_ORDERED_RESULT_SET);
                                if (orderedResultSetStr!=null){
                                        if (orderedResultSetStr.equalsIgnoreCase("oldStyle")){
                                                initColumnsNameString((Boolean)null);
                                        }else if (orderedResultSetStr.equalsIgnoreCase("withPrefix")){
                                                useOrderedWithTable = new Boolean(true);
                                                initColumnsNameString(useOrderedWithTable);
                                        }else if (orderedResultSetStr.equalsIgnoreCase("noPrefix")){
                                                useOrderedWithTable = new Boolean(false);
                                                initColumnsNameString(useOrderedWithTable);
                                        }else{
                                                printMsg(Logger.DEBUG,"<xsl:value-of select="CLASS_NAME"/>DO : Invalid value for OrderedResultSet parameter. Using default. ");
                                        }
                                }else{
                                        initColumnsNameString((Boolean)null);
                                }
                tweak = ((StandardLogicalDatabase)DODS.getDatabaseManager().findLogicalDatabase(dbName)).getDriverDependencies();
                        } catch (DatabaseManagerException e){
                                printMsg(Logger.DEBUG,"<xsl:value-of select="CLASS_NAME"/>DO : Unable to read configuration for OrderedResultSet. Using default. ");
                        }

            XMLConfig dodsConf = Common.getDodsConf();
            String cacheClassPath = null;
            String cacheClassName = null;

                        String queryCacheImplClass =
                                ((StandardLogicalDatabase)DODS.getDatabaseManager().findLogicalDatabase(dbName)).getDatabaseConfiguration().getQueryCacheImplClass();
            try {
            if (queryCacheImplClass==null){
                                        cacheClassPath = dodsConf.getText("CacheJar");
                                        cacheClassName = dodsConf.getText("CacheClassName");
                                        if (cacheClassPath != null && cacheClassName != null) {
                                                MultiClassLoader loader = new MultiClassLoader(null);
                                                loader.setClassPath(cacheClassPath);
                                                Class cacheClass = loader.loadClass(cacheClassName);
                                                cache = (DataStructCache)cacheClass.newInstance();
                                                cache = cache.newInstance();
                                        } else  {
                                                cache = new QueryCacheImpl();
                                        }
            }else{
                                        Class cacheClass = Class.forName(queryCacheImplClass);
                                        cache = (DataStructCache)cacheClass.newInstance();
                                        cache = cache.newInstance();
            }
            } catch ( Exception e ) {}

            if (cache == null) {
                cache = new QueryCacheImpl();
            }
            readCacheConfiguration(get_logicalDBName());
            get_statistics(); // set statistics

          calculateCacheParameters();
          if (getAsynchLoadPriority() >= 0) { // tj added 25.02.2006
            asynchCacheLoadNeeded = true;
          } else if (0 != cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize()) {
              DODS.getLogChannel(Thread.currentThread()).write(Logger.INFO,
                                "Starting synchronous cache load for class: " + "<xsl:value-of select="PACKAGE"/>.<xsl:value-of select="CLASS_NAME"/>DO");
              refreshCache();
              DODS.getLogChannel(Thread.currentThread()).write(Logger.INFO,
                                "Finished synchronous cache load for class: " + "<xsl:value-of select="PACKAGE"/>.<xsl:value-of select="CLASS_NAME"/>DO");
          } else {
              refreshCache();
          }
        } catch ( Exception e ) {
            // cannot throw from static block
        }
    }


     /**
     * Queries all rows in table, and for each row
     * creates a DO instance in the cache.
     * For these DOs, data.readOnly = true,
     * which causes set methods to throw an exception.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    private static void calculateCacheParameters()
    throws java.sql.SQLException, DatabaseManagerException, ObjectIdException, DataObjectException {

                int maxSize = cache.getCacheAdministration(CacheConstants.DATA_CACHE).getMaxCacheSize(); // tj 18.07.2007.
                if (maxSize != 0) { // tj 18.07.2007.
        int numOfRows = 0;
        int synchLoadRowCountLimit = cache.getSynchLoadRowCountLimit();
        int simpleCacheRowCountLimit = cache.getSimpleCacheRowCountLimit();
       
                        if (synchLoadRowCountLimit > 0 || simpleCacheRowCountLimit > 0) {
      <xsl:value-of select="CLASS_NAME"/>Query query;
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
        if (usedDatabase != null) {
            // JP 2007-10-09
            DBTransaction tmpTrans = null;
                    try {
                                String database;
                                for (Iterator i = usedDatabase.iterator(); i.hasNext();) {
                                        database = (String)i.next();<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
                                        query = new <xsl:value-of select="CLASS_NAME"/>Query (database);</xsl:if><xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                        tmpTrans = DODS.getDatabaseManager().createTransaction(database);
                                        query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTrans); </xsl:if>
                                        <xsl:value-of select="CLASS_NAME"/>DO obj;
                                        numOfRows = query.getCount();<xsl:if test="/TABLE/GENERATE_DIRTY='Omit'">
                        //JP 2007-10-09
                        //tmpTrans.release();
                        </xsl:if>
                                }
                            } catch (DatabaseManagerException e) {
                                throw new DataObjectException("INTERNAL ERROR: unexpected DatabaseManagerException", e);
                            } catch ( NonUniqueQueryException ex ) {
                                // Since we do not call query.requireUniqueInstance()
                                // this should never happen.
                                throw new ObjectIdException( "Duplicate ObjectId" );
                            }
            //JP 2007-10-09
            finally {
                if (tmpTrans != null) {
                    tmpTrans.release();
                }
            }
        } else {
</xsl:if>
                        DBTransaction tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
                            query = new <xsl:value-of select="CLASS_NAME"/>Query (tmpTransaction);
                            try {
                           numOfRows = query.getCount();
                //JP 2007-10-09
                //tmpTransaction.release();
                             } catch ( NonUniqueQueryException ex ) {
                                    // Since we do not call query.requireUniqueInstance()
                                    // this should never happen.
                                    throw new ObjectIdException( "Duplicate ObjectId" );
                             }
             //JP 2007-10-09
             finally {
                if (tmpTransaction != null) {
                    tmpTransaction.release();
                }
             }
<xsl:if test="DO_IS_MULTIDB_BASED='true'">
          }</xsl:if>
         
                         if (synchLoadRowCountLimit > 0) {
                          if (numOfRows >= synchLoadRowCountLimit && getAsynchLoadPriority() < 0) {
                                  //cache.setAsynchLoadPriority(numOfRows);
                                  cache = (DataStructCache)(UpdateConfigurationAdministration.setAsynchLoadPriority(cache, numOfRows));
                                }
                         }

                         if (simpleCacheRowCountLimit > 0) {
                          if (numOfRows >= simpleCacheRowCountLimit) {
                                                   simpleCacheUsed = false;
                                                   //cache.getCacheAdministration(CacheConstants.SIMPLE_QUERY_CACHE).setMaxCacheSize(0);
                                                   CacheAdministration simpleCache = cache.getCacheAdministration(CacheConstants.SIMPLE_QUERY_CACHE);
                                                   simpleCache = UpdateConfigurationAdministration.setMaxCacheSize(simpleCache, 0);
                    }
                                 }
                        }
                } // if (maxSize != 0)
    }

    /**
     * This method is invoked whenever object needs to be loaded from database.
     *
     * @exception DataObjectException If a data access error occurs.
     */
    public void refresh() throws DataObjectException {
        try {
            loadData();
        } catch ( Exception e ) {
            throw new DataObjectException("Unable to load data for <xsl:value-of select="CLASS_NAME"/>DO id=" + get_OId() +
                                          ", error = ", e);
        }
    }

    /**
     * This method is invoked whenever objects needs to be loaded from database.
     *
     * @param DOs Array of DOs which will be red from database.
     *
     * @exception DataObjectException If a data access error occurs.
     */
    public static void refresh(<xsl:value-of select="CLASS_NAME"/>DO[] DOs) throws DataObjectException {
        for (int i=0; i<DOs.length; i++)
            DOs[i].refresh();
    }


    /**
     * Refresh cache by removing from the cache results of the query
     * <i>querySnt</i>
     *
     * @param querySnt query used in this
     * @exception QueryException If a data access error occurs.
     */
         public static void refresh(String querySnt)  throws QueryException {
                 try {
                   QueryBuilder qb = new QueryBuilder();
                   qb.select( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey);
                   qb.addWhere(querySnt);
         BigDecimal objId;
         String handle;
         String database = get_logicalDBName();
                   RDBRow row;
                   try {
                           while ( null != ( row = qb.getNextRow() ) ) {
                                objId = row.get( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey ).getBigDecimal();
                                   handle = objId.toString();
                       removeFromCache(database, handle);
                           }
                   }catch ( Exception e ) {
                           throw new QueryException(" Query Exception occured," );
                   }
         }catch (Exception ex){
                 System.out.println("Error in refresh(String) of DO object.");
            }
         }

<xsl:if test="/TABLE/GENERATE_INSECURE='true' and not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createVirgin()
     * Creates a DO that has no ObjectId or data.
     * Such a DO is used to insert a new database entry
     * after its data has been set.
     *
     * @return Created data object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     *
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createVirgin(DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin()
    throws DatabaseManagerException, ObjectIdException {
        try {
            if ((DODS.getDatabaseManager().getConfig().getBoolean("DB." + get_logicalDBName() + ".JTA",
                                                               DODS.getDatabaseManager()
                                                                  .getConfig()
                                                                  .getBoolean("defaults.JTA",
                                                                              false)))) {
                return new <xsl:value-of select="CLASS_NAME"/>DO(DODS.getDatabaseManager().createTransaction(get_logicalDBName()));
            }
        } catch (ConfigException e) {
        } catch (SQLException e) {
        }
        return new <xsl:value-of select="CLASS_NAME"/>DO();
    }
</xsl:if>

<xsl:if test="/TABLE/GENERATE_INSECURE='true'">
    /**
     * createVirgin(DBTransaction)
     * @param dbTrans The current database transaction
     * @return Created data object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin(DBTransaction dbTrans)
    throws DatabaseManagerException, ObjectIdException {
        return new <xsl:value-of select="CLASS_NAME"/>DO (dbTrans);
    }
</xsl:if>


<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true' and not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createVirgin(org.webdocwf.dods.access.User)
     * Creates a DO that has no ObjectId or data.
     * Such a DO is used to insert a new database entry
     * after its data has been set.
     *
     * @param usr The user for security check.
     *
     * @return Created data object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   The user is not allowed to create new instances
     *
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createVirgin(User, DBTransaction) instead.
</xsl:if>
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin( org.webdocwf.dods.access.User usr )
    throws DatabaseManagerException, ObjectIdException, AccessException {
        assertDOCreateAccess( usr );
<xsl:if test=" /TABLE/GENERATE_INSECURE='true'">
        return createVirgin();
</xsl:if>
<xsl:if test=" /TABLE/GENERATE_INSECURE='false'">
        return new <xsl:value-of select="CLASS_NAME"/>DO ();
</xsl:if>
    }
</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createVirgin(org.webdocwf.dods.access.User)
     *
     * @param usr The user for security check.
     * @param dbTrans The current database transaction
     * @return Created data object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   The user is not allowed to create new instances
     *
     * WebDocWf extension
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin(DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws DatabaseManagerException, ObjectIdException, AccessException {
        assertDOCreateAccess( usr );
<xsl:if test=" /TABLE/GENERATE_INSECURE='true'">
        return createVirgin(dbTrans);
</xsl:if>
<xsl:if test=" /TABLE/GENERATE_INSECURE='false'">
        return new <xsl:value-of select="CLASS_NAME"/>DO (dbTrans);
</xsl:if>
    }
</xsl:if>


</xsl:if>
<xsl:if test="DO_IS_MULTIDB_BASED='true' and /TABLE/GENERATE_INSECURE='true' and not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createVirgin(String)
     * Creates a DO that has no ObjectId or data.
     * Such a DO is used to insert a new database entry
     * after its data has been set.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     *
     * @return Created data object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createVirgin(String,DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin(String dbName)
    throws DatabaseManagerException, ObjectIdException {
        if (dbName == null)
            dbName = get_logicalDBName();
        return new <xsl:value-of select="CLASS_NAME"/>DO (dbName);
    }
</xsl:if>
<xsl:if test="DO_IS_MULTIDB_BASED='true' and DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true' and not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createVirgin(String, org.webdocwf.dods.access.User)
     * Creates a DO that has no ObjectId or data.
     * Such a DO is used to insert a new database entry
     * after its data has been set.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param usr The user for security check.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   The user is not allowed to create new instances
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createVirgin(String, User, DBTransaction) instead.
</xsl:if>
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createVirgin( String dbName, org.webdocwf.dods.access.User usr )
    throws DatabaseManagerException, ObjectIdException, AccessException {
        if (dbName == null)
            dbName = get_logicalDBName();
        assertDOCreateAccess( usr );
<xsl:if test=" /TABLE/GENERATE_INSECURE='true'">
        return createVirgin(dbName);
</xsl:if>
<xsl:if test=" /TABLE/GENERATE_INSECURE='false'">
        return new <xsl:value-of select="CLASS_NAME"/>DO (dbName);
</xsl:if>
    }
</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'">
    /**
     * Ensure that the given user is allowed to create new instances.
     *
     * @param usr The user for security check.
     *
     * @exception AccessException If user is not allowed to create new instances.
     *
     * WebDocWf extension
     *
     */
    public static void assertDOCreateAccess( org.webdocwf.dods.access.User usr )
    throws AccessException {
        if (! hasDOCreateAccess( usr ))
            throw new AccessRightException("No access !", usr, "Get", null, "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO", null, null, null, null, null);
    }

    /**
     * Check whether the given user is allowed to create new instances.
     *
     * @param usr The user for security check.
     *
     * @return Whether the given user is allowed to create new instances.
     *
     * WebDocWf extension
     *
     */
    public static boolean hasDOCreateAccess( org.webdocwf.dods.access.User usr )
    throws AccessEvalException {
        return usr.hasDOCreateAccess( "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO" );
    }
    // end of WebDocWf extension for DODS row instance security

</xsl:if>
<xsl:if test="DO_IS_OID_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createExisting( BigDecimal )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed BigDecimal value as the primary key.
     *
     * Creates a DO that represents an existing entry in the database.
     * Such a DO is used to examine and possibly update such an entry.
     * createExisting() is called only from the code that retrieves
     * an ObjectId from a ResultSet (database query result).
     * createExisting() is protected because no other DO or BO should ever
     * need to call it.
     * FIX unfortunately the createExisting(BigDecimal) form *does* need
     * to be public because it is called by the public ctors of other DOs.
     * For example:
     * AaaDO contains a ref to a BbbDO,
     * so there is a method AaaDO.setBbb(BbbDO).
     * In the ctor AaaDO(ResultSet), we have the call
     * setBbb( BbbDO.createExisting( rs.getBigDecimal( "bbb")));
     * Since AaaDO is not in the same package as BbbDO,
     * BbbDO.createExisting(BigDecimal) must be public, not protected.
     * Java needs the C++ 'friend' idea.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExistring(BigDecimal, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {<!--
        try {
            if ((DODS.getDatabaseManager().getConfig().getBoolean("DB." + get_logicalDBName() + ".JTA",
                                                               DODS.getDatabaseManager()
                                                                  .getConfig()
                                                                  .getBoolean("defaults.JTA",
                                                                              false)))) {
                return publicCreateExisting(null, bd, DODS.getDatabaseManager().createTransaction(get_logicalDBName()));
            }
        } catch (ConfigException e) {
        } catch (Exception e) {
            e.printStackTrace(); // TODO Auto-generated catch block
        } -->
        return publicCreateExisting(null, bd, null);
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == bd)
            return null;
        return ceInternal(new ObjectId(bd));
    }
</xsl:if>

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(BigDecimal bd, DBTransaction dbTrans)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == bd)
            return null;
        return ceInternal(new ObjectId(bd), dbTrans);
    }

    /**
     * createExisting(BigDecimal, DBTransaction)
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(BigDecimal bd, DBTransaction dbTrans)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        return publicCreateExisting(null, bd, dbTrans);
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createExisting( String, BigDecimal )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed BigDecimal value as the primary key.
     *
     * Creates a DO that represents an existing entry in the database.
     * Such a DO is used to examine and possibly update such an entry.
     * createExisting() is called only from the code that retrieves
     * an ObjectId from a ResultSet (database query result).
     * createExisting() is protected because no other DO or BO should ever
     * need to call it.
     * FIX unfortunately the createExisting(BigDecimal) form *does* need
     * to be public because it is called by the public ctors of other DOs.
     * For example:
     * AaaDO contains a ref to a BbbDO,
     * so there is a method AaaDO.setBbb(BbbDO).
     * In the ctor AaaDO(ResultSet), we have the call
     * setBbb( BbbDO.createExisting( rs.getBigDecimal( "bbb")));
     * Since AaaDO is not in the same package as BbbDO,
     * BbbDO.createExisting(BigDecimal) must be public, not protected.
     * Java needs the C++ 'friend' idea.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param bd The BigDecimal representation of the ObjectId for the object.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(BigDecimal, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String dbName, BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        return publicCreateExisting(dbName, bd, null);
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param dbName Logical name of the database
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == bd)
            return null;
        if (dbName == null)
            dbName = get_logicalDBName();
        return ceInternal(dbName,new ObjectId(bd));
    }
<!--
    /**
     * createExisting(String, BigDecimal)
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed BigDecimal value as the primary key.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param dbTrans The current database transaction
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(BigDecimal, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String dbName, BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        return publicCreateExisting(dbName, bd, null);
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, BigDecimal bd)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == bd)
            return null;
        return ceInternal(dbName, new ObjectId(bd));
    }
-->
</xsl:if>
</xsl:if></xsl:if>

<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createExisting( BigDecimal, org.webdocwf.dods.access.User )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed BigDecimal value as the primary key.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception AccessException
     *   The user is not allowed to read the instance existance
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(BigDecimal, User, DBTransaction) instead.
</xsl:if>
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(BigDecimal bd, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = publicCreateExisting(null, bd, null);
        ret.assertDOGetAccess(usr);
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(BigDecimal bd, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        if (null == bd)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(new ObjectId(bd));
        ret.assertDOGetAccess(usr);
        return ret;
    }
</xsl:if>
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createExisting(BigDecimal, org.webdocwf.dods.access.User , DBTransaction)
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @param dbTrans The current database transaction.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception AccessException
     *   The user is not allowed to read the instance existance
     *
     * WebDocWf extension
     *
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO createExisting(BigDecimal bd, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = publicCreateExisting(null, bd, dbTrans);
        ret.assertDOGetAccess(usr);
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @param usr The user for security check.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(BigDecimal bd, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        if (null == bd)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(new ObjectId(bd), dbTrans);
        ret.assertDOGetAccess(usr);
        return ret;
    }
</xsl:if>
<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'">
<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createExisting(String, BigDecimal, org.webdocwf.dods.access.User)
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed BigDecimal value as the primary key.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception AccessException
     *   The user is not allowed to read the instance existance
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(BigDecimal, User, DBTransaction) instead.
</xsl:if>
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String dbName, BigDecimal bd, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = publicCreateExisting(dbName, bd, null);
        ret.assertDOGetAccess(usr);
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param dbName Logical name of the database
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     *
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     * @exception ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, BigDecimal bd, org.webdocwf.dods.access.User usr)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException, AccessException {
        if (null == bd)
            return null;
        if (dbName == null)
            dbName = get_logicalDBName();
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(dbName, new ObjectId(bd));
        ret.assertDOGetAccess(usr);
        return ret;
    }

</xsl:if></xsl:if>
<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Check whether the given user is allowed to read the DO existance.
     * Static function to be called without having the object.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Whether the given user is allowed to read the DO existance
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use hasDOGetAccess( BigDecimal, User, DBTransaction) instead.
</xsl:if>
     * WebDocWf extension
     *
     */
    public static boolean hasDOGetAccess(BigDecimal bd, org.webdocwf.dods.access.User usr)
    throws AccessEvalException {
        <xsl:value-of select="CLASS_NAME"/>DO newDO;
        try {
            newDO = ceInternal(new ObjectId(bd));
        } catch (Exception e) {
            throw new AccessEvalException("Error in hasDoGetAccess/createExisting !", e, usr, "Get", null,
                                          "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO", null,null, null, null, null);
        }
        return usr.hasDOGetAccess(newDO);
    }
</xsl:if>

    /**
     * Check whether the given user is allowed to read the DO existance.
     * Static function to be called without having the object.
     *
     * @param bd The BigDecimal representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @param dbTrans.
     *
     * @return Whether the given user is allowed to read the DO existance
     *
     * WebDocWf extension
     *
     */
    public static boolean hasDOGetAccess(BigDecimal bd, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws AccessEvalException {
        <xsl:value-of select="CLASS_NAME"/>DO newDO;
        try {
            newDO = ceInternal(new ObjectId( bd ) , dbTrans);
        } catch (Exception e) {
            throw new AccessEvalException("Error in hasDoGetAccess/createExisting !", e, usr, "Get", null,
                                          "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO", null,null, null, null, null);
        }
        return usr.hasDOGetAccess(newDO);
    }
    // end of WebDocWf extension for DODS row instance security
</xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createExisting(String)
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param handle String representation of the ObjectId for the object.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(String, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String handle) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = publicCreateExisting(null, bd, null);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param handle String representation of the ObjectId for the object.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String handle) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = ceInternal(bd);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }
</xsl:if>

    /**
     * createExisting(String, DBTransaction)
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String handle, DBTransaction dbTrans) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = publicCreateExisting(null, bd, dbTrans);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String handle, DBTransaction dbTrans) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = ceInternal(bd, dbTrans);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * createExisting(String, String)
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(String, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String dbName, String handle) {
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = publicCreateExisting(dbName, bd, null);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param dbName Logical name of the database
     * @param handle String representation of the ObjectId for the object.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, String handle) {
        if (dbName == null)
            dbName = get_logicalDBName();
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        try {
            BigDecimal bd = new BigDecimal(handle);
            ret = ceInternal(dbName,bd);
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n : Create existing failed");
        }
        return ret;
    }
</xsl:if></xsl:if>


<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createExisting( String, org.webdocwf.dods.access.User )
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * WebDocWf extension
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(String, User, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String handle,org.webdocwf.dods.access.User usr)
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = createExisting(handle);
        if (null != ret) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String handle,org.webdocwf.dods.access.User usr)
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(handle);
        if (null != ret) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }

</xsl:if>
    // WebDocWf extension for DODS row instance security

    /**
     * createExisting(String, org.webdocwf.dods.access.User, DBTransaction)
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @param dbTrans The current database transaction
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * WebDocWf extension
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String handle, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = createExisting(handle, dbTrans);
        if (null != ret) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param handle String representation of the ObjectId for the object.
     * @param dbTrans The current database transaction
     * @param usr The user for security check.
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String handle, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(handle, dbTrans);
        if (null != ret) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * createExisting(String, String, org.webdocwf.dods.access.User)
     *
     * The createExisting method is used to create a <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     * from a string handle.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param handle String representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * WebDocWf extension
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createExisting(String, User, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createExisting(String dbName, String handle, org.webdocwf.dods.access.User usr)
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = createExisting(dbName, handle);
        if (ret!=null) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }

    /**
     * Method ceInternal is public, only to allow generated classes
     * to instantiate one another. Public modifier doesn't mean user
     * application could use it - it mustn't.
     *
     * @param dbName Logical name of the database
     * @param handle String representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return instance of <xsl:value-of select="CLASS_NAME"/>DO or null
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, String handle, org.webdocwf.dods.access.User usr)
    throws AccessException {
        if (dbName == null)
            dbName = get_logicalDBName();
        <xsl:value-of select="CLASS_NAME"/>DO ret = ceInternal(dbName, handle);
        if (ret!=null) {
            ret.assertDOGetAccess(usr);
        }
        return ret;
    }
</xsl:if></xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Check whether the given user is allowed to read the DO existance
     * Static function to be called without having the object
     *
     * @param handle The string representation of the ObjectId for the object.
     * @param usr The user for security check.
     *
     * @return Whether the given user is allowed to read the DO existance
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use hasDOGetAccess( String, User, DBTransaction) instead.
</xsl:if>
     * WebDocWf extension
     *
     */
    public static boolean hasDOGetAccess(String handle, org.webdocwf.dods.access.User usr)
    throws AccessEvalException {
        <xsl:value-of select="CLASS_NAME"/>DO newDO;
        try {
            newDO = ceInternal(handle);
        } catch (Exception e) {
            throw new AccessEvalException("Error in hasDoGetAccess/createExisting !", e, usr, "Get",null,
                                          "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO", null, null, null, null, null);
        }
        return usr.hasDOGetAccess( newDO );
    }
</xsl:if>

    /**
     * Check whether the given user is allowed to read the DO existance
     * Static function to be called without having the object
     *
     * @param handle The string representation of the ObjectId for the object.
     * @param usr The user for security check.
     * @param dbTrans The current database transaction
     * @return Whether the given user is allowed to read the DO existance
     *
     * WebDocWf extension
     *
     */
    public static boolean hasDOGetAccess(String handle, DBTransaction dbTrans, org.webdocwf.dods.access.User usr)
    throws AccessEvalException {
        <xsl:value-of select="CLASS_NAME"/>DO newDO;
        try {
            newDO = ceInternal(handle, dbTrans);
        } catch (Exception e) {
            throw new AccessEvalException("Error in hasDoGetAccess/createExisting !", e, usr, "Get",null,
                                          "<xsl:value-of select="translate(PACKAGE,'/','.')"/>.<xsl:value-of select="CLASS_NAME"/>DO", null, null, null, null, null);
        }
        return usr.hasDOGetAccess( newDO );
    }
    // end of WebDocWf extension for DODS row instance security

</xsl:if>

    /**
     * ceInternal(ObjectId, DBTransaction)
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed ObjectID value as the primary key.
     *
     * @param id The ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(ObjectId id, DBTransaction dbTrans)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {

        boolean isNewDO = true;

        if (null == id)
            return null;
        String cacheHandle = get_logicalDBName()+"."+tableName+"."+id.toString();
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        <xsl:value-of select="CLASS_NAME"/>DataStruct data = null;
        if (null!= dbTrans && null!= _tr_(dbTrans).getTransactionCache()) {
            ret = (<xsl:value-of select="CLASS_NAME"/>DO)_tr_(dbTrans).getTransactionCache().getDOByHandle(cacheHandle);
            isNewDO=ret==null;
        }
        if (ret==null) {
            ret = (<xsl:value-of select="CLASS_NAME"/>DO)createDO (id, dbTrans);
        }
        if (ret.get_DataStruct().isEmpty()) {
            data = findCachedObjectByHandle(cacheHandle);
            if (data != null) {
               ret.originalData_set(data);
            } else if (cacheHandle.startsWith("null.")) {
               DODS.getLogChannel().write(Logger.ERROR, "cache handle starts with null, get_logicalDBName()="+ get_logicalDBName() , new Throwable());
            } else if (cache.isFull() && isFullCacheNeeded && DODS.getLogChannel().isEnabled(Logger.DEBUG)) {
               printMsg(Logger.DEBUG, "==================");
               printMsg(Logger.DEBUG, "datastruct cache size "+cache.getCacheAdministration(0).getCacheSize());
               printMsg(Logger.DEBUG, "simple qry cache size "+cache.getCacheAdministration(1).getCacheSize());
               printMsg(Logger.DEBUG, "complex qy cache size "+cache.getCacheAdministration(2).getCacheSize());
               printMsg(Logger.DEBUG, "multij qry cache size "+cache.getCacheAdministration(3).getCacheSize());
               printMsg(Logger.DEBUG, "cache content "+cache.getCacheContent());
               printMsg(Logger.DEBUG, "data not found in cache for "+ cacheHandle);
               printMsg(Logger.DEBUG, "==================");
            }
        }
        if (isNewDO) ret.setPersistent(true);  // mark DO as persistent (preexisting)

        //if (!cache.getTableConfiguration().isLazyLoading() ) { // If not lazy-loading, fetch DO data now.
        if (!cache.getTableConfiguration().isLazyLoading() || (cache.isFull() && isFullCacheNeeded)) { // tj 25.02.2006
           if(ret.get_DataStruct().isEmpty()) {<!--
              printMsg(Logger.WARNING, "==================");
              printMsg(Logger.WARNING, "originalData "+ ret.originalData_get());
              DODS.getLogChannel().write(Logger.WARNING, "second  data "+ ret.get_Data(), new Throwable());
              printMsg(Logger.WARNING, "=================="); -->
              ret.loadData();
           }
        } else {
            statistics.incrementLazyLoadingNum();
        }
        // unset the GenericDO.dirty flag.
        if(isNewDO)
         ret.markClean();

        return ret;
    }

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( ObjectId )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed ObjectID value as the primary key.
     *
     * @param id The ObjectId for the object.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(ObjectId, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(ObjectId id)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == id )
            return null;
        return ceInternal(id, null);
    }
</xsl:if>

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( String, ObjectId , HashMap)
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed ObjectID value as the primary key.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param id The ObjectId for the object.
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(ObjectId, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, ObjectId id)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (dbName == null)
            dbName = get_logicalDBName();
        if ( null == id )
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        <xsl:value-of select="CLASS_NAME"/>DataStruct data = null;
        String cacheHandle = dbName+"."+tableName+"."+id.toString();
        data = (<xsl:value-of select="CLASS_NAME"/>DataStruct)findCachedObjectByHandle( cacheHandle );
        if ( data != null ){
            ret = (<xsl:value-of select="CLASS_NAME"/>DO)createDO (data.get_OId());
            if(ret!=null) {
                            ret.originalData_set(data);
                            ret.setPersistent(true);
                        }
            return ret;
        }
        ret = new <xsl:value-of select="CLASS_NAME"/>DO( dbName,id );
        ret.setPersistent( true );  // mark DO as persistent (preexisting)
        // changed by tj 15.06.2003.
        // before: if ( ! <xsl:value-of select="IS_LAZY_LOADING"/> ) { // If not lazy-loading, fetch DO data now.
        //if (!cache.getTableConfiguration().isLazyLoading() ) { // If not lazy-loading, fetch DO data now.
        if (!cache.getTableConfiguration().isLazyLoading() || (cache.isFull() && isFullCacheNeeded)) { // tj 25.02.2006
            ret.loadData();
        } else {
            statistics.incrementLazyLoadingNum();
        }
        // unset the GenericDO.dirty flag.
        ret.markClean();
        return ret;
    }
</xsl:if>

<!--xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
   /**
     * ceInternal( String, ObjectId )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed ObjectID value as the primary key.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param id The ObjectId for the object.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(ObjectId, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, ObjectId id )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == id )
            return null;
        return ceInternal(dbName, id);
      }
</xsl:if-->
</xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( ResultSet , HashMap)
     *
     * Factory method used to create an instance of this class to
     * represent a Data Object already existing in the database.
     *
     * @param rs The ResultSet returned by the Query class for
     * an existing Data Object stored in the database.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(ResultSet, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(ResultSet rs)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == rs)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        if ( notUsingOId ) {
            ret = new <xsl:value-of select="CLASS_NAME"/>DO();
            ret.initFromResultSet(rs);
        } else {
            ret = new <xsl:value-of select="CLASS_NAME"/>DO(rs);
        }
        return ret;
    }
</xsl:if>

    /**
     * ceInternal(ResultSet, DBTransaction)
     *
     * @param rs The ResultSet returned by the Query class for
     * an existing Data Object stored in the database.
     * @param dbTrans The current database transaction
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(ResultSet rs, DBTransaction dbTrans)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == rs )
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        if ( notUsingOId ) {
            ret = new <xsl:value-of select="CLASS_NAME"/>DO (dbTrans);
            ret.initFromResultSet(rs);
        } else {
            BigDecimal tmpOid = rs.getBigDecimal(get_OIdColumnName());
            String cacheHandle = get_logicalDBName()+"."+tableName+"."+tmpOid;
            if (null!= dbTrans && null!= _tr_(dbTrans).getTransactionCache()) {
               ret = (<xsl:value-of select="CLASS_NAME"/>DO)_tr_(dbTrans).getTransactionCache().getDOByHandle(cacheHandle);
            }
            if (null != ret) {
                if (!ret.isLoaded()) {
                    ret.initFromResultSet(rs);
                }
                return ret;
            }
            if (useOrderedWithTable != null){
            ret = new <xsl:value-of select="CLASS_NAME"/>DO (new ObjectId(tmpOid),dbTrans);
            ret.initFromResultSet(rs);
            //if(dbTrans!=null) dbTrans.lockDO(this);
            }else{
                                ret = new <xsl:value-of select="CLASS_NAME"/>DO (rs, dbTrans );
            }
        }
        return ret;
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( String, ResultSet )
     *
     * Factory method used to create an instance of this class to
     * represent a Data Object already existing in the database.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param rs The ResultSet returned by the Query class for
     * an existing Data Object stored in the database.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(ResultSet, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, ResultSet rs )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (dbName == null)
            dbName = get_logicalDBName();
        if ( null == rs )
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        if ( notUsingOId ) {
            ret = new <xsl:value-of select="CLASS_NAME"/>DO (dbName);
            ret.initFromResultSet( rs );
        } else {
            ret = new <xsl:value-of select="CLASS_NAME"/>DO ( dbName, rs );
        }
        return ret;
    }

</xsl:if>

</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( RDBRow )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey value
     * in the passed RDBRow.
     *
     * @param row A row returned by QueryBuilder.getNextRow().
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBRow does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(RDBRow, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(RDBRow row )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == row )
            return null;
        RDBColumnValue pk = null;
        try {
            pk = row.get( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey );
            return ceInternal( pk );
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, row does not " +
                                          "contain <xsl:value-of select="CLASS_NAME"/>DO primary key." );
        }
    }
</xsl:if>

    /**
     * ceInternal( RDBRow , DBTransaction)
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey value
     * in the passed RDBRow.
     *
     * @param row A row returned by QueryBuilder.getNextRow().
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBRow does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(RDBRow row, DBTransaction dbTrans )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == row )
            return null;
        RDBColumnValue pk = null;
        try {
            pk = row.get( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey );
            return ceInternal( pk, dbTrans );
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, row does not " +
                                          "contain <xsl:value-of select="CLASS_NAME"/>DO primary key." );
        }
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( String, RDBRow )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey value
     * in the passed RDBRow.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param RDBRow A row returned by QueryBuilder.getNextRow().
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBRow does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(RDBRow, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, RDBRow row )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (dbName == null)
            dbName = get_logicalDBName();
        if ( null == row )
            return null;
        RDBColumnValue pk = null;
        try {
            pk = row.get( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey );
            return ceInternal( dbName,pk );
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, row does not " +
                                          "contain <xsl:value-of select="CLASS_NAME"/>DO primary key." );
        }
    }
</xsl:if></xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( RDBColumnValue )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *
     * @param pk a PrimaryKey column value from a row that was returned by
     * QueryBuilder.getNextRow().
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBColumnValue does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(RDBColumnValue, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(RDBColumnValue pk )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == pk )
            return null;
        if ( ! pk.equals( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey ) )
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, " +
                                          "RDBColumnValue is not <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey." );
        BigDecimal bd = null;
        try {
            bd = pk.getBigDecimal();
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, bad primary key." );
        }
        if ( null == bd )
            return null;
        return ceInternal( bd );
    }
</xsl:if>


    /**
     * ceInternal( RDBColumnValue, DBTransaction )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *
     * @param pk a PrimaryKey column value from a row that was returned by
     * QueryBuilder.getNextRow().
     * @param dbTrans The current database transaction.
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBColumnValue does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(RDBColumnValue pk, DBTransaction dbTrans )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if ( null == pk )
            return null;
        if ( ! pk.equals( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey ) )
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, " +
                                          "RDBColumnValue is not <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey." );
        BigDecimal bd = null;
        try {
            bd = pk.getBigDecimal();
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, bad primary key." );
        }
        if ( null == bd )
            return null;
        return ceInternal( bd , dbTrans);
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * ceInternal( String, RDBColumnValue )
     *
     * Factory method creates a <xsl:value-of select="CLASS_NAME"/>DO object by searching for it
     * in the database using the passed <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param RDBColumnValue a PrimaryKey column value from a row
     * that was returned by QueryBuilder.getNextRow().
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception DataObjectException
     *   If the RDBColumnValue does not contain a <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey.
     *   If the object is not found in the database.
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use ceInternal(RDBColumnValue, DBTransaction) instead.
</xsl:if>
     */
    protected static <xsl:value-of select="CLASS_NAME"/>DO ceInternal(String dbName, RDBColumnValue pk )
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (dbName == null)
            dbName = get_logicalDBName();
        if ( null == pk )
            return null;
        if ( ! pk.equals( <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey ) )
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, " +
                                          "RDBColumnValue is not <xsl:value-of select="CLASS_NAME"/>DO.PrimaryKey." );
        BigDecimal bd = null;
        try {
            bd = pk.getBigDecimal();
        } catch ( Exception e ) {
            throw new DataObjectException("Cannot create <xsl:value-of select="CLASS_NAME"/>DO, bad primary key." );
        }
        if ( null == bd )
            return null;
        return ceInternal(dbName,bd);
    }
</xsl:if></xsl:if></xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param data The data struct to copy values from.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createCopy(<xsl:value-of select="CLASS_NAME"/>DataStruct, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DataStruct data )
    throws DatabaseManagerException, ObjectIdException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (true);
        ret.originalData_set(data);
        return ret;
    }
</xsl:if>
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param data The data struct to copy values from.
     * @param dbTrans The current database transaction
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DataStruct data, DBTransaction dbTrans )
    throws DatabaseManagerException, ObjectIdException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (true, dbTrans);
        ret.originalData_set(data);
        ret.markClean();
        return ret;
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param data The data struct to copy values from.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createCopy(<xsl:value-of select="CLASS_NAME"/>DataStruct, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( String dbName, <xsl:value-of select="CLASS_NAME"/>DataStruct data )
    throws DatabaseManagerException, ObjectIdException {
        if (dbName == null)
            dbName = get_logicalDBName();
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (dbName);
        ret.originalData_set(data);
        ret.markClean();
        return ret;
    }

</xsl:if>
</xsl:if>

    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param orig The original DO to copy.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DO orig )
    throws DatabaseManagerException, ObjectIdException {
        if (null == orig)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (true);
        if (null != orig.originalData_get()) {
            ret.originalData_set(orig.originalData_get());
            ret.markClean();
            ret.transaction = orig.transaction;
            ret.setPersistent(orig.isPersistent());
        }
        return ret;
    }

   /**
     *
     * @param orig The original DO to copy.
     * @param dbTrans The current database transaction
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DO orig, DBTransaction dbTrans )
    throws DatabaseManagerException, ObjectIdException {
        if (null == orig)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (true, dbTrans);
        if (null != orig.originalData_get()) {
            ret.originalData_set(orig.originalData_get());
            ret.markClean();
            ret.setPersistent(orig.isPersistent());
        }
        return ret;

    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param orig The original DO to copy.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createCopy(<xsl:value-of select="CLASS_NAME"/>DO, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( String dbName, <xsl:value-of select="CLASS_NAME"/>DO orig )
    throws DatabaseManagerException, ObjectIdException {
        if (dbName == null)
            dbName = get_logicalDBName();
        if (null == orig)
            return null;
        <xsl:value-of select="CLASS_NAME"/>DO ret = new <xsl:value-of select="CLASS_NAME"/>DO (dbName);
        if (orig.isLoaded()) {
            ret.originalData_set(orig.get_DataStruct()/*.duplicate()*/);
            ret.markClean();
            ret.transaction = orig.transaction;
            ret.setPersistent(orig.isPersistent());
        }
        return ret;
    }

</xsl:if>
</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param orig The original DO to copy.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   If the user is not allowed to make a copy.
     *
     * WebDocWf extension
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DO orig, org.webdocwf.dods.access.User usr )
    throws DatabaseManagerException, ObjectIdException, AccessException {
        orig.assertDOCopyAccess ( usr );
        <xsl:value-of select="CLASS_NAME"/>DO ret = createCopy ( orig );
        return ret;
    }

    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
    /**

     * @param orig The original DO to copy.
     * @param usr The user for security check.
     * @param dbTrans The current database transaction
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   If the user is not allowed to make a copy.
     *
     * WebDocWf extension
     *
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( <xsl:value-of select="CLASS_NAME"/>DO orig, DBTransaction dbTrans, org.webdocwf.dods.access.User usr )
    throws DatabaseManagerException, ObjectIdException, AccessException {
        orig.assertDOCopyAccess ( usr );
        <xsl:value-of select="CLASS_NAME"/>DO ret = createCopy ( orig, dbTrans );
        return ret;
    }

<xsl:if test="DO_IS_MULTIDB_BASED='true'"><xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Creates a DO that has no ObjectId
     * but has a copy of an existing DO's data.
     * Such a DO is used to insert a new database entry
     * that is largely similar to an existing entry.
     *
     * @param dbName Logical name of the database from which
     * <xsl:value-of select="CLASS_NAME"/>DO object will be created.
     * @param orig The original DO to copy.
     * @param usr The user for security check.
     *
     * @return Created <xsl:value-of select="CLASS_NAME"/>DO object.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     * @exception AccessException
     *   If the user is not allowed to make a copy
     *
     * WebDocWf extension
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createCopy(String, <xsl:value-of select="CLASS_NAME"/>DO, User, DBTransaction) instead.
</xsl:if>
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO createCopy( String dbName, <xsl:value-of select="CLASS_NAME"/>DO orig, org.webdocwf.dods.access.User usr )
    throws DatabaseManagerException, ObjectIdException, AccessException {
        if (dbName == null)
            dbName = get_logicalDBName();
        orig.assertDOCopyAccess ( usr );
        <xsl:value-of select="CLASS_NAME"/>DO ret = createCopy ( dbName,orig );
        return ret;
    }

</xsl:if>
    </xsl:if>
    // end of WebDocWf extension for DODS row instance security
</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true'">
    /**
     * Causes the DO to refresh itself from the database
     * the next time a set or get method is called.
     */
    public void reload() {
        originalData = data = null;
    }
</xsl:if>

<xsl:if test="DO_IS_OID_BASED='true'">
    /**
     * The methods <CODE>
     *     get_Handle
     *     hasMatchingHandle
<xsl:if test="DO_IS_OID_BASED='true'">
     *     findCachedObjectByHandle
</xsl:if>
     * </CODE> are used by Presentation Objects that need to populate
     * HTML select lists with Data Objects as options.
     * The <CODE>get_Handle()</CODE> method is used
     * to set the value for each option,
     * and the <CODE>hasMatchingHandle()<CODE>
<xsl:if test="DO_IS_OID_BASED='false'">
     * and <CODE>findCachedObjectByHandle()<CODE>
</xsl:if>
     * methods are used to lookup the Data Object when the selection has
     * been made.
     *
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     *
     * @return id of this DO as a string
     *   If an object's id can't be allocated for this object.
     */
    public String  get_Handle()
    throws DatabaseManagerException {
        /*
        String ret = null;
        if ( null == get_OId() )
               throw new DatabaseManagerException( "ID not set " );
        ret = get_OId().toString();
        return ret;
        */
        if (null == __the_handle)
            throw new DatabaseManagerException( "ID not set " );
        return __the_handle;
    }

    /**
     * Returns cache handle.
     *
     * @return cache handle.
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public String  get_CacheHandle()
    throws DatabaseManagerException {
        String ret = get_OriginDatabase()+ "."+getTableName()+ "." + get_Handle();
        return ret;
    }
</xsl:if>

<xsl:if test="not(/TABLE/GENERATE_DIRTY='Omit')">
    /**
     * Created DO with specified OID.
     *
     * @param oid DO's oid.
     * @return copy of DO (with the same id).
     *
     * @exception SQLException
     * @exception ObjectIdException
     * @exception DataObjectException
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
<xsl:if test="/TABLE/GENERATE_DIRTY='Deprecate'">
     * @deprecated Use createDO(ObjectId, DBTransaction) instead.
</xsl:if>
     */
    public static GenericDO createDO(ObjectId oid) throws java.sql.SQLException, com.lutris.appserver.server.sql.ObjectIdException, com.lutris.dods.builder.generator.query.DataObjectException, com.lutris.appserver.server.sql.DatabaseManagerException{
        return new <xsl:value-of select="CLASS_NAME"/>DO(oid);
    }
</xsl:if>

    /**
     * Created DO with specified OID.
     *
     * @param oid DO's oid.
     * @param dbTrans The current database transaction.
     * @return copy of DO (with the same id).
     *
     * @exception SQLException
     * @exception ObjectIdException
     * @exception DataObjectException
     * @exception DatabaseManagerException
     *   If a connection to the database cannot be established, etc.
     */
    public static GenericDO createDO(ObjectId oid, DBTransaction dbTrans) throws java.sql.SQLException, com.lutris.appserver.server.sql.ObjectIdException, com.lutris.dods.builder.generator.query.DataObjectException, com.lutris.appserver.server.sql.DatabaseManagerException{
        return new <xsl:value-of select="CLASS_NAME"/>DO(oid, dbTrans);
    }

<xsl:if test="DO_IS_OID_BASED='true'">
   /**
     * Compare string version of the id of this DO and handle.
     *
     * @param handle
     *   <CODE>String</CODE> version of DO id.
     *
     * @return boolean
     *   True if the string version of the id of this DO matches passed handle.
     *
     * @see <xsl:value-of select="CLASS_NAME"/>DO#get_Handle() get_Handle
     */
    public boolean hasMatchingHandle( String handle ) {
        boolean ret = false;
        if (null == __the_handle) {
           return false;
        } else {
           //String thisHnadle = get_OId().toString();
           ret = __the_handle.equals( handle );
        }
        return ret;
    }
</xsl:if>

   /**
     * Get data object with key cacheHandle from the cache.
     *
     * @param cacheHandle
     *   <CODE>String</CODE> version of concatenation of:
     * name of the data object's database, followed by '.', followed by
     * data object's id.
     *
     * @return <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     *   Object if one is found in cache, otherwise null.
     *
     * @see <xsl:value-of select="CLASS_NAME"/>DO#get_Handle() get_Handle
     */
    public <xsl:value-of select="CLASS_NAME"/>DO findTransactionCachedObjectByHandle( String cacheHandle ){
        if ( null == cacheHandle )
            return null;
        if(get_transaction()!=null && _tr_(get_transaction()).getTransactionCache()!= null)
            return (<xsl:value-of select="CLASS_NAME"/>DO)_tr_(get_transaction()).getTransactionCache().getDOByHandle( cacheHandle );
        else
            return null;
    }

     /**
     * Get DataStruct object with key cacheHandle from the cache.
     *
     * @param cacheHandle
     *   <CODE>String</CODE> version of concatenation of:
     * name of the data object's database, followed by '.', followed by
     * data object's id.
     *
     * @return <CODE><xsl:value-of select="CLASS_NAME"/>DataStruct</CODE>
     *   Object if one is found in cache, otherwise null.
     *
     * @see <xsl:value-of select="CLASS_NAME"/>DO#get_Handle() get_Handle
     */
    public static <xsl:value-of select="CLASS_NAME"/>DataStruct findCachedObjectByHandle( String cacheHandle ){
        if ( null == cacheHandle )
            return null;
        return ( <xsl:value-of select="CLASS_NAME"/>DataStruct ) cache.getDataStructByHandle( cacheHandle );
    }

<xsl:if test="DO_IS_OID_BASED='true' and /TABLE/GENERATE_SECURE='true'">
    // WebDocWf extension for DODS row instance security
    // The following lines have been added:
     /**
     * Get data object with key cacheHandle from the cache.
     *
     * @param cacheHandle
     *   <CODE>String</CODE> version of concatenation of:
     * name of the data object's database, followed by '.', followed by
     * data object's id.
     * @param usr The user for security check
     *
     * @return <CODE><xsl:value-of select="CLASS_NAME"/>DO</CODE>
     *   Object if one is found in cache, otherwise null.
     *
     * WebDocWf extension
     */
    public <xsl:value-of select="CLASS_NAME"/>DO findTransactionCachedObjectByHandle( String cacheHandle,org.webdocwf.dods.access.User usr )
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DO ret = findTransactionCachedObjectByHandle( cacheHandle );
        if (ret != null)
            ret.assertDOGetAccess( usr );
        return ret;
    }

    /**
     * Get DataStruct object with key cacheHandle from the cache.
     *
     * @param cacheHandle
     *   <CODE>String</CODE> version of concatenation of:
     * name of the data object's database, followed by '.', followed by
     * data object's id.
     * @param usr The user for security check
     *
     * @return <CODE><xsl:value-of select="CLASS_NAME"/>DataStruct</CODE>
     *   Object if one is found in cache, otherwise null.
     *
     * WebDocWf extension
     */
    public static <xsl:value-of select="CLASS_NAME"/>DataStruct findCachedObjectByHandle( String cacheHandle,org.webdocwf.dods.access.User usr )
    throws AccessException {
        <xsl:value-of select="CLASS_NAME"/>DataStruct obj = findCachedObjectByHandle( cacheHandle );
        <xsl:value-of select="CLASS_NAME"/>DO ret = null;
        if (obj != null) {
        //JP 2007-10-09
        DBTransaction tmpTransaction = null;
         try {
            tmpTransaction = DODS.getDatabaseManager().createTransaction(get_logicalDBName());
            ret = (<xsl:value-of select="CLASS_NAME"/>DO)createDO (obj.get_OId(), tmpTransaction);
                        ret.originalData_set(obj);
                        ret.setPersistent(true);
                        //JP 2007-10-09
                        //tmpTransaction.release();
         } catch (Exception ex) {}
            if(ret!=null)
                ret.assertDOGetAccess( usr );
         }
         finally {
            if (tmpTransaction != null) {
                tmpTransaction.release();
            }
         }
        return obj;
    }
    // end of WebDocWf extension for DODS row instance security
</xsl:if>

    /**
     * Assigns the DataStruct of an existing DO to this DO.
     * Does not duplicate data. Just assigns the reference.
     *
     * @param orig The original DO.
     *
     */
    protected void makeIdentical( <xsl:value-of select="CLASS_NAME"/>DO orig ) {
        super.makeIdentical(orig);
        originalData = orig.originalData;
        data = orig.data;
    }

    /* *
     * Return Data object's version.
     * @return Data object's version.
     * /
    public int getVersion() {
        return get_Version();
    }*/

    /**
     * get_Version makes the protected method public in CoreDO.
     *
     * @return Data object's version.
     */
    public int get_Version() {
        return (null != data)?data.get_Version():super.get_Version();
    }

    /**
     * get_NewVersion overloaded
     *
     * @return Data object's version.
     */
    public int get_NewVersion() {
        if (null != data)
            return data.get_Version();
        else
            return super.get_Version();
    }

    /* *
     * setVersion overloaded.
     * @param _ver DO's version.
     * /
    public void setVersion(int _ver) {
         set_Version(_ver);
    }*/

    /**
     * set_Version overloaded.
     *
     * @param _ver DO's version.
     */
    public void set_Version(int _ver) {
        if(_ver < get_Version()) {
            new Throwable("WOW, ("+get_OId()+") oldVer:"+get_Version()+", new one is "+_ver).printStackTrace();
        } else if (null != data)
            data.set_Version(_ver);
        else
            super.set_Version(_ver);
    }

    /**
     * set_NewVersion overloaded.
     *
     * @param _ver Ignored.
     */
    public void set_NewVersion(int _ver){
        try {
            doTouch();
        } catch (Exception e) {
            printMsg(Logger.DEBUG," <xsl:value-of select="CLASS_NAME"/>DO class\n :"+" can't set new version ");
        }
    }

    // WebDocWf extension for writeable fully cached objects
    /**
     * Mark the object as read-only.
     *
     * WebDocWf extension
     *
     */
    public void makeReadOnly() {
        if (null != data) {
          try{
            checkLoad(true);
          }catch(Exception ex) {
            printMsg(Logger.DEBUG, " MakeReadOnly failed: Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_OId()+", version: "+get_Version()+" \n");
            (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));
          }
        }
         data.readOnly = true;
    }

    /**
     * Mark the object as read-write.
     *
     * WebDocWf extension
     */
    public void makeReadWrite() {
        if (null != data) {
          try{
            checkLoad(true);
          }catch(Exception ex) {
            printMsg(Logger.DEBUG, " MakeReadWrite failed: Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_OId()+", version: "+get_Version()+" \n");
            (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

          }
        }
         data.readOnly = false;
    }
    // end of WebDocWf extension for writeable fully cached objects

    // WebDocWf extension for writeable fully cached objects

    /**
     * Return Object with the handle <i>key</i> from reference objects HashMap.
     *
     * @param handle DO's handle.
     * @param cbt CachedDBTransaction
     * @return Object with the handle <i>key</i> from reference objects HashMap.
     */
    public static <xsl:value-of select="CLASS_NAME"/>DO retrieveFromTxCache(CachedDBTransaction cbt, Object handle) {
        if (null != handle && null != cbt && null != cbt.getTransactionCache()) {
            String key = cbt.getDatabaseName() +"."+ tableName +"."+ handle.toString();
            return (<xsl:value-of select="CLASS_NAME"/>DO)cbt.getTransactionCache().getDOByHandle(key);
        }
        return null;
    }

    /* *
     * Returns this object's identifier.
     * @return this object's identifier.
     * /
    public ObjectId getOId() {
        return get_OId();
    }*/

    /**
     * Returns this object's identifier.
     * @return this object's identifier.
     */
    public ObjectId get_OId() {
        return get_DataStruct().get_OId();
    }

    private String __the_handle;

    /**
     * Sets this object's identifier.
     * @param _oId this object's identifier.
     */
    protected void set_OId(ObjectId _oId) {
        if (get_DataStruct() == null)
            originalData = new <xsl:value-of select="CLASS_NAME"/>DataStruct();
        get_DataStruct().set_OId(_oId);
        __the_handle = _oId.toString();
        addToTransactionCache(this, get_transaction());
    }

    /**
     * Creates a clone of the object, but ensures that
     * a new and unique object id is created for the object
     * and that the version number is set to zero.
     *
     * @return Cloned object.
     * @exception DatabaseManagerException if an error occurs while
     * allocation a new object id from the default logical database.
     * @exception ObjectIdException if a new object id could not be
     * allocated.
     */
    public synchronized Object cloneUnique()
        throws DatabaseManagerException, ObjectIdException {

        <xsl:value-of select="CLASS_NAME"/>DO _clone = new <xsl:value-of select="CLASS_NAME"/>DO (get_transaction());

        try {
            checkLoad(false);
            <xsl:value-of select="CLASS_NAME"/>DataStruct toClone = (null != get_Data())
                     ?(<xsl:value-of select="CLASS_NAME"/>DataStruct)get_Data()
                     :(<xsl:value-of select="CLASS_NAME"/>DataStruct)originalData_get();
            if (null != toClone) {
                _clone.set_Data(toClone.duplicate());
                ((<xsl:value-of select="CLASS_NAME"/>DataStruct)_clone.get_Data()).set_OId(((<xsl:value-of select="CLASS_NAME"/>DataStruct)_clone.originalData_get()).get_OId());
                ((<xsl:value-of select="CLASS_NAME"/>DataStruct)_clone.get_Data()).set_Version(0);
                changedFlags_set(true);
            }
        } catch (Exception e) {
            printMsg(Logger.DEBUG," cloneUnique failed: Database: "+get_OriginDatabase()+" <xsl:value-of select="CLASS_NAME"/>DO class, oid: "+get_Handle()+", version: "+get_Version()+" \n");
           (new Throwable()).printStackTrace(DODS.getLogChannel().getLogWriter(Logger.WARNING));

        }
        return _clone;
    }

    protected boolean deleted;

    /**
     * Returns the value of delete tag.
     * @return true if DO has been deleted, but not commited yet
     */
    public boolean isDeleted() {
        return deleted;
    }

    /**
     * Sets the value of delete tag.
     * @param flag true if DO has been deleted, but not commited yet.
     */
    public void setDeleted(boolean flag) {
        deleted = flag;
    }


    /**
     * If transaction succeeded marks this object as clean.
     * @param success true if the transaction succeeded
     *   and this object was successfully inserted into the database.
     */
    public void finalizeInsert(boolean success) {
        // on rollback reject inserted (createdVirgin) DO
        if (!success && !isPersistent())
            setDeleted(true);
        super.finalizeInsert(success);
        if (success)
            syncStructs(true);
    }

    /**
     * If transaction succeeded marks this object as clean.
     * @param success true if the transaction succeeded
     *   and this object was successfully updated in the database.
     */
    public void finalizeUpdate(boolean success) {
        super.finalizeUpdate(success);
        if (success)
            syncStructs(true);
    }

    /**
     * Currently does nothing.
     *
     * @param success true if the transaction succeeded
     *   and this object was successfully deleted from the
     *   database.
     */
    public void finalizeDelete(boolean success) {
        super.finalizeDelete(success);
        if (success) {
            deleteFromCache();
        }
    }

    /**
     * Method SyncStructs(boolean _updateCache).
     *
     * @param _updateCache boolean value.
     */
    private synchronized void syncStructs(boolean _updateCache) {
        if (null != data)
            originalData = data;
        data = null;
        changedFlags_set(false);
        ((<xsl:value-of select="CLASS_NAME"/>DataStruct)originalData).readOnly = true;
        if (_updateCache)
            updateCache();
        else // tj 20.02.2007.
            addToCache();
    }

    /**
     * Returns information whether the DO is created virgin and hasn't been
     * commited yet.
     * @return true for DO that's created virgin and hasn't been commited yet.
     */
    public boolean isVirgin() {
        return !isPersistent();
    }

    /**
     * Make DO's data from cache visible.
     */
    public void makeVisible () {
        try {
            ((QueryCache)cache).makeVisible(get_CacheHandle());
        } catch (DatabaseManagerException dme) {
            System.err.println("makeVisible for "+super.toString()+"failed");
        }
    }

    /**
     * Make DO's  data from cache Invisible.
     */
    public void makeInvisible () {
        try {
            ((QueryCache)cache).makeInvisible(get_CacheHandle());
        } catch (DatabaseManagerException dme) {
            System.err.println("makeInvisible for "+super.toString()+"failed");
        }
    }

    /**
     * Inserts this object into the database.
     *
     * @param conn the database connection.
     * @exception java.sql.SQLException if a database access error occurs.
     * @exception DBRowUpdateException If a version error occurs.
     */
    public synchronized void executeInsert(DBConnection conn)
    throws SQLException/*, DBRowUpdateException*/ {
        if (dirty) {
            super.executeInsert(conn);
<xsl:for-each select="//COLUMN">
    <xsl:if test="DB_TYPE='LONGVARBINARY'">
        <xsl:call-template name="tweakInsertBLOB"/>
    </xsl:if>
</xsl:for-each>
            changedFlags_set(false);
        }
    }

    public synchronized void executeUpdate(DBConnection conn)
        throws SQLException/*, DBRowUpdateException*/ {
        if (dirty) {
            super.executeUpdate(conn);
<xsl:for-each select="//COLUMN">
    <xsl:if test="DB_TYPE='LONGVARBINARY'">
        <xsl:call-template name="tweakInsertBLOB"/>
    </xsl:if>
</xsl:for-each>
            changedFlags_set(false);
        }
    }

    /**
     * Returns value for AutoSave.
     * @return true if AutoSave is on, otherwise false.
     */
    protected boolean isAutoSave()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(get_OriginDatabase()))).getDatabaseConfiguration().getAutoSave();
      } catch (Exception ex) {}
      return flag;
    }

    /**
     * Returns value for AutoSaveCreateVirgin.
     * @return true if AutoSaveCreateVirgin is on, otherwise false.
     */
    protected boolean isAutoSaveCreateVirgin()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(get_OriginDatabase()))).getDatabaseConfiguration().getAutoSaveCreateVirgin();
      } catch (Exception ex) {}
      return flag;
    }

    /**
     * Returns value for TransactionCheck.
     * @return true if TransactionCheck is on, otherwise false.
     */
    protected boolean isTransactionCheck()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(get_OriginDatabase()))).getDatabaseConfiguration().getTransactionCheck();
      } catch (Exception ex) {}
      return flag;
    }

    /**
     * Returns value for TransactionCaches.
     * @return true if TransactionCaches are on, otherwise false.
     */
    protected boolean isTransactionCaches()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(get_OriginDatabase()))).getDatabaseConfiguration().getTransactionCaches();
      } catch (Exception ex) {}
      return flag;
    }

    /**
     * Returns value for DeleteCheckVersion.
     * @return true if DeleteCheckVersion is on, otherwise false.
     */
    protected boolean isDeleteCheckVersion()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(this.get_OriginDatabase()))).getDatabaseConfiguration().getDeleteCheckVersion();
      } catch (Exception ex) {}
      return flag;
    }


    /**
     * Returns value for AllReadOnly.
     * @return true if AllReadOnly is on, otherwise false.
     */
    protected static boolean isAllReadOnly()
    {
      boolean flag = false;
      try {
        flag = ((StandardLogicalDatabase)(DODS.getDatabaseManager().findLogicalDatabase(get_logicalDBName()))).getDatabaseConfiguration().isAllReadOnly();
      } catch (Exception ex) {}
      return flag;
    }


    /**
     * Load the actual DO data if necessary.
     * Called by get/set methods.
     *
     * @exception DataObjectException If a data access error occurs.
     */
    protected void checkLoad() throws DataObjectException {
                checkLoad(false);
    }



     /**
     * Undo action.
     *
     * @exception DataObjectException
     */
    public void undo()throws com.lutris.dods.builder.generator.query.DataObjectException
    {
      try{
        if(null != transaction){
                if((data!=null) || (data==null && isDeleted())){
                        int tempVersion=get_Version();
                                if(isDeleted() && !isDeletedFromDatabase){
                                                unDelete(transaction);
                                }else if (isDeleted() && isDeletedFromDatabase){
                                        data =((<xsl:value-of select="CLASS_NAME"/>DataStruct)originalData).duplicate();
                                        set_Version(tempVersion);
                                        persistent=false;
                                        deleted=false;
                                        isDeletedFromDatabase=false;
                                        if (isAutoSave()) {
                            save(transaction,false);
                        }
                                }else{
                                        data =((<xsl:value-of select="CLASS_NAME"/>DataStruct)originalData).duplicate();
                                        set_Version(tempVersion);
                                        if ( isAutoSave()) {
                            save(transaction,false);
                        }
                                }
                }
        }else{
                        throw new DataObjectException("Error during Undo operation");
                }
      }catch(Exception ex){
                throw new DataObjectException("Error during Undo operation");
      }

    }

    /**
     *
     */
    private void doAutoSave() throws DataObjectException {
        if (autoSaveAllowed&&null != transaction&&isAutoSave()) {
            try {
                save(transaction,false);
            } catch (Exception ex) {
                throw new DataObjectException("Error during transaction's writting data into database",
                                              ex);
            }
        }
    }

    /**
     * dumpData action.
     *
     * @param incrementVersion Increment version.
     */
    public void dumpData(boolean incrementVersion) {
        ObjectId _oid = get_OId();
        int _version = (incrementVersion?1:0)+ get_Version();
//        originalData_set(new <xsl:value-of select="CLASS_NAME"/>DataStruct());
        originalData = data = null;
        set_OId(_oid);
        set_Version(_version);
    }

    /**
     * reloadData discards all changes application made to this object,
     * and goes into database to fetch contents there.
     * Object itself becomes clean as if no changes were made.
     *
     * @exception com.lutris.appserver.server.sql.ObjectIdException
     *   If an object's id can't be allocated for this object.
     * @exception DataObjectException
     *   If the object is not found in the database.
     * @exception SQLException
     *   If the database rejects the SQL generated to retrieve data
     *   for this object, or if the table contains a bad foreign key, etc.
     */
    public void reloadData() throws SQLException, ObjectIdException, DataObjectException {
        dumpData(false);
        loadData();
    }

    /**
     * publicCreateExisting action.
     *
     * @param _dbName Database name.
     * @param _oid DO's oid.
     * @param dbt Current transaction.
     * @return Created DO or null if doesn't exist.
     *
     * @exception SQLException
     * @exception ObjectIdException
     * @exception DataObjectException
     * @exception DatabaseManagerException
     */
    private static <xsl:value-of select="CLASS_NAME"/>DO publicCreateExisting(String _dbName, BigDecimal _oid, DBTransaction dbt)
    throws SQLException, ObjectIdException, DataObjectException, DatabaseManagerException {
        if (null == _oid)
            return null;
        if (null == _dbName)
            _dbName = get_logicalDBName();
        if (null == dbt) {
            try {
                if ((DODS.getDatabaseManager().getConfig().getBoolean("DB." + _dbName + ".JTA",
                                                                   DODS.getDatabaseManager()
                                                                      .getConfig()
                                                                      .getBoolean("defaults.JTA",
                                                                                  false)))) {
                    dbt = DODS.getDatabaseManager().createTransaction(_dbName);
                }
            } catch (ConfigException e) {
            } catch (Exception e) {
                e.printStackTrace(); // TODO Auto-generated catch block
            }
        }
        <xsl:value-of select="CLASS_NAME"/>Query qry = new <xsl:value-of select="CLASS_NAME"/>Query(dbt);
        qry.setLogicalDatabase(_dbName);
        qry.setQueryOId(new ObjectId(_oid));
        qry.requireUniqueInstance();
        try {
            return qry.getNextDO();
        } catch (com.lutris.dods.builder.generator.query.NonUniqueQueryException nuqe) {
            throw new DataObjectException("Query didn't give unique result.");
        }
    }

    public int hashCode() {
        return __the_handle.hashCode();
    }

        void writeXMLProperties(java.io.Writer w) throws DataObjectException {
                try {
                        w.write("  <wrs:properties>\n");
                        w.write("    <wrs:command>SELECT ");
            w.write((null == originalData||get_DataStruct().isEmpty())
                     ? get_OIdColumnName() +", "+ get_versionColumnName()
                     : "*");
                        w.write(" FROM <xsl:value-of select="TABLE_NAME"/>"
                    + " WHERE "+get_OIdColumnName() +"="+ get_Handle()
                    + " AND "+ get_versionColumnName() +"="+ get_Version()
                    + "</wrs:command>\n");
                        w.write("    <wrs:concurrency></wrs:concurrency>\n");
                        w.write("    <wrs:datasource></wrs:datasource>\n");
                        w.write("    <wrs:escape-processing></wrs:escape-processing>\n");
                        w.write("    <wrs:fetch-direction></wrs:fetch-direction>\n");
                        w.write("    <wrs:fetch-size></wrs:fetch-size>\n");
                        w.write("    <wrs:isolation-level></wrs:isolation-level>\n");
                        w.write("    <wrs:key-columns></wrs:key-columns>\n");
                        w.write("    <wrs:map></wrs:map>\n");
                        w.write("    <wrs:max-field-size></wrs:max-field-size>\n");
                        w.write("    <wrs:max-rows></wrs:max-rows>\n");
                        w.write("    <wrs:query-timeout></wrs:query-timeout>\n");
                        w.write("    <wrs:read-only></wrs:read-only>\n");
                        w.write("    <wrs:rowset-type></wrs:rowset-type>\n");
                        w.write("    <wrs:show-deleted></wrs:show-deleted>\n");
                        w.write("    <wrs:table-name><xsl:value-of select="TABLE_NAME"/></wrs:table-name>\n");
                        w.write("    <wrs:url></wrs:url>\n");
                        w.write("    <wrs:sync-provider>\n");
                        w.write("      <wrs:sync-provider-name>"+ this.getClass().getName() +"</wrs:sync-provider-name>\n");
                        w.write("      <wrs:sync-provider-vendor>Together Relational Objects</wrs:sync-provider-vendor>\n");
                        w.write("      <wrs:sync-provider-version>7.0-5</wrs:sync-provider-version>\n");
                        w.write("      <wrs:sync-provider-grade>LOW</wrs:sync-provider-grade>\n");
                        w.write("      <wrs:data-source-lock></wrs:data-source-lock>\n");
                        w.write("    </wrs:sync-provider>\n");
                        w.write("  </wrs:properties>\n");
                } catch (Exception e) {
                        throw new DataObjectException("Writing of WebRowSet", e);
                }
        }

        public void writeXML(Writer ow) throws DataObjectException {
                try {
                        Writer w = new java.io.StringWriter();
                    <xsl:value-of select="CLASS_NAME"/>DataStruct.writeXMLhead(w);
                        writeXMLProperties(w);
                        <xsl:value-of select="CLASS_NAME"/>DataStruct.writeXMLMetadata(w);
                        w.write("  <wrs:data>\n");
                        get_DataStruct().writeXMLData(w);
                        w.write("  </wrs:data>\n</wrs:webRowSet>\n");
                        ow.write(w.toString());
                } catch (DataObjectException e) {
                        throw e;
                } catch (Exception e) {
                        throw new DataObjectException("Writing of WebRowSet", e);
                }
        }
   
    public boolean equals(Object obj) {
        return (obj instanceof <xsl:value-of select="CLASS_NAME"/>DO)
           && this.__the_handle.equals(((<xsl:value-of select="CLASS_NAME"/>DO)obj).__the_handle);
    }
</xsl:template>
<xsl:template name="tweakInsertBLOB">            if (tweak.isBlobAccessSpecial()) {
                try {
                    tweak.insertBlob(conn,
                                     get<xsl:value-of select="common:capitalizeName(@name)"/>(),
                                     PrimaryKey,
                                     <xsl:value-of select="common:capitalizeName(@name)"/>,
                                     get_Handle());
                } catch (Exception e) {
                    throw new SQLException("Row insert failed - "+e.getMessage());
                }
            }</xsl:template>
</xsl:stylesheet>



--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: New enhydra releases

by Petr Stehlik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sinisa Milosevic wrote:
> Enhydra Server 7.2-1
> (http://forge.objectweb.org/project/showfiles.php?group_id=21)

Thanks!

However, tas-community-runtime-7.2-1.i386.tar.gz is missing the
"manager" webapp from TomCat. Any reason for that? I have copied the
"manager" from tomcat 6.0 release and it works nicely. Can't imagine
deploying enhydra apps without it...

Also, if I may add a couple of bug reports:

First, ./configure does not configure conf/wrapper.conf properly:

     # echo $JAVA_HOME
     /usr/local/jdk1.6.0_03
     # tas-community-runtime-7.2/multiserver/enhydra# ./configure

./configure run reports

     BUILD SUCCESSFUL
     Total time: 3 seconds

but it didn't set the "wrapper.java.command" in wrapper.conf:

     # grep wrapper\.java\.command ../conf/wrapper.conf
     wrapper.java.command=/bin/java

It should contain $JAVA_HOME/bin/java (i.e.
/usr/local/jdk1.6.0_03/bin/java in my case). This is however easy to fix
after the installation.


Another problem is that subsequent running of the ./configure or
./configureBase reports:
     ./tmp.properties: line 31: tomcat.service.name=Catalina: command
not found

This is probably caused by the dots in the "tomcat.service.name"
variable in the build.properties file (generated by the first
./configure run) - a bash environment variable cannot contain dots, can
it? Could they by replaced by underscores, for example?



Third problem is with the ./configureBase:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     ....
     show:
          [echo] os=unix
          [echo]
enhydra.dir=/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multiserver-base/enhydra

     configure:

     BUILD FAILED
 
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/build.xml:761:
     The following error occurred while executing this line:
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multiserver-base/enhydra/build.xml:308:
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multiserver-base/enhydra/dist/enhydra
not found.

Total time: 2 seconds
ERROR: Enhydra Base could not been configured
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in the multiserver-base/enhydra/dist only the following files exist:

     bin/       build.xml  conf/      webapps/



What is the multiserver-base good for, anyway? Do I need it for running
Enhydra apps on a web server?

Thanks

Petr

P.S. will you make Kelp for TDS 7.2-1 available, please? BTW, there is a
problem in the TDS 7.1 and 7.2 that prevents from running the
applications - I'll report that in a separate mail...




--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

RE: New enhydra releases

by Slobodan Vujasinovic-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

You are right, tomcat documentation, manager and host-manager are not
included in enhydra runtime distribution. This is bug in our build procedure
and it will be fixed in next enhydra release!

Also, you are right about "configureBase" shell script (it is not upgraded
to the latest directory changes introduced with Tomcat 6.0). This tool is
designed to allow you to create separate "CATALINA_BASE" (multiserver)
directory containing separate server configuration files and corresponding
directory infrastructure but without binary redundancy on the file system.

Server and other "shared" libraries are deployed in one (main) multiserver
directory (CATALINA_HOME) and server configuration files are also deployed
in this same multiserver directory (CATALINA_HOME) but (optionally) also in
several other multiserver directories (CATALINA_BASE).

This scenario can be useful if you are having multiple enhydra instances
running on the same physical machine but (of course) using different
connection and shutdown ports (easier maintenance and lower hard disk
requirements).

"configureBase" allows you create and configure such (CATALINA_BASE)
directories!


Regarding "configure" shell script, it should be executed with "-jdk.dir"
parameter!
In our next release, we'll also implement $JAVA_HOME environment variable
recognition.

Regarding Kelp, new (v7.2-1) Kelp release is coming in next few days.

Thank you very much for those problem reports!
We'll resolve those issues for our next release.

Regards,
  Slobodan Vujasinovic


-----Original Message-----
From: Petr Stehlik [mailto:pstehlik@...]
Sent: Friday, 14 December, 2007 19:25
To: enhydra@...
Subject: Re: [enhydra] New enhydra releases

Sinisa Milosevic wrote:
> Enhydra Server 7.2-1
> (http://forge.objectweb.org/project/showfiles.php?group_id=21)

Thanks!

However, tas-community-runtime-7.2-1.i386.tar.gz is missing the "manager"
webapp from TomCat. Any reason for that? I have copied the "manager" from
tomcat 6.0 release and it works nicely. Can't imagine deploying enhydra apps
without it...

Also, if I may add a couple of bug reports:

First, ./configure does not configure conf/wrapper.conf properly:

     # echo $JAVA_HOME
     /usr/local/jdk1.6.0_03
     # tas-community-runtime-7.2/multiserver/enhydra# ./configure

./configure run reports

     BUILD SUCCESSFUL
     Total time: 3 seconds

but it didn't set the "wrapper.java.command" in wrapper.conf:

     # grep wrapper\.java\.command ../conf/wrapper.conf
     wrapper.java.command=/bin/java

It should contain $JAVA_HOME/bin/java (i.e.
/usr/local/jdk1.6.0_03/bin/java in my case). This is however easy to fix
after the installation.


Another problem is that subsequent running of the ./configure or
./configureBase reports:
     ./tmp.properties: line 31: tomcat.service.name=Catalina: command
not found

This is probably caused by the dots in the "tomcat.service.name"
variable in the build.properties file (generated by the first
./configure run) - a bash environment variable cannot contain dots, can
it? Could they by replaced by underscores, for example?



Third problem is with the ./configureBase:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     ....
     show:
          [echo] os=unix
          [echo]
enhydra.dir=/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multise
rver-base/enhydra

     configure:

     BUILD FAILED
 
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/build.xml:761:
     The following error occurred while executing this line:
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multiserver-base/en
hydra/build.xml:308:
/tmp/pokus/tas-community-runtime-7.2/multiserver/enhydra/multiserver-base/en
hydra/dist/enhydra
not found.

Total time: 2 seconds
ERROR: Enhydra Base could not been configured
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in the multiserver-base/enhydra/dist only the following files exist:

     bin/       build.xml  conf/      webapps/



What is the multiserver-base good for, anyway? Do I need it for running
Enhydra apps on a web server?

Thanks

Petr

P.S. will you make Kelp for TDS 7.2-1 available, please? BTW, there is a
problem in the TDS 7.1 and 7.2 that prevents from running the
applications - I'll report that in a separate mail...






--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: New enhydra releases

by Petr Stehlik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Slobodan Vujasinovic wrote:
> Hi,

Slobodan,

> You are right, tomcat documentation, manager and host-manager are not
> included in enhydra runtime distribution. This is bug in our build procedure
> and it will be fixed in next enhydra release!

Very good.

> Also, you are right about "configureBase" shell script (it is not upgraded
> to the latest directory changes introduced with Tomcat 6.0).

I see. BTW, I was hoping the Tomcat 6 will finally resolve the
OutOfMemory problem (PermGen space) that Enhydra is suffering from ever
since (it's actually a JDK bug, most probably) but it still happens
after several deploy/undeploys..

> This scenario can be useful if you are having multiple enhydra instances
> running on the same physical machine but (of course) using different
> connection and shutdown ports (easier maintenance and lower hard disk
> requirements).
>
> "configureBase" allows you create and configure such (CATALINA_BASE)
> directories!

This sounds great. I'll try to remember such easy and clear explanation
but if you added it to the README.txt it would be even better (as I tend
to forget everything :-)

> Regarding "configure" shell script, it should be executed with "-jdk.dir"
> parameter!

The README.txt says:
======================
To configure the enhydra distribution:

cd to '<enhydra_root>/multiserver/enhydra' directory and type in the
following command:

configure    (Windows)

./configure  (Linux)
======================

So no mention of -jdk.dir...

Also, few lines below where you explain how to prepare the
build.properties file you say:

"jdk.dir - the path to your installation of the Java Development Kit
(obligational if environment variable JAVA_HOME isn't (properly) defined)"

So basically the -jdk.dir is not documented as a requirement for correct
configuration.

> In our next release, we'll also implement $JAVA_HOME environment variable
> recognition.

Something as simple as the following patch would work:

--- multiserver/enhydra/configure.old   2007-10-26 18:37:38.000000000 +0200
+++ multiserver/enhydra/configure       2007-12-18 10:09:43.000000000 +0100
@@ -99,7 +99,6 @@
         then
                 JAVA_HOME=$(expr "x$param" : 'x[^=]*=\(.*\)')
                 export JAVA_HOME
-               jdk_DOT_dir=$JAVA_HOME
                 continue
         fi

@@ -315,6 +314,7 @@

  done

+jdk_DOT_dir=$JAVA_HOME

  export PATH=$JAVA_HOME/bin:$PATH


> Thank you very much for those problem reports!
> We'll resolve those issues for our next release.

Thanks for your great work on TAS/TDS.

Petr




--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

RE: New enhydra releases

by Slobodan Vujasinovic-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

"OutOfMemory" should be easy to resolve!

We've introduced (exposed) this (memory based) JVM configuration parameters
for the users.
They get configured trough enhydra configuration process ("configure" shell
script) and are the part of the "build.properties" parameters.

Properties are:

jvmxms=256
jvmxmx=512
jvmps=32
jvmmps=128

The faster way would be (if you have everything already configured) to edit
those values directly in corresponding configuration files!

Depending of you startup type:

1. Wrapper based startup
- Parameters are configured in "wrapper.conf" file placed in
"<multiserver>/conf" directory
...
wrapper.java.additional.4=-Xms256m
wrapper.java.additional.5=-Xmx512m
wrapper.java.additional.6=-XX:PermSize=32m
wrapper.java.additional.7=-XX:MaxPermSize=128m
...

2. Catalina shell based startup
- Parameters are configured in "catalina.sh" file placed in
"<multiserver>/bin" directory
...
# Additional Enhydra JVM memory setting
JAVA_OPTS="-Xms256m $JAVA_OPTS"
JAVA_OPTS="-Xmx512m $JAVA_OPTS"
JAVA_OPTS="-XX:PermSize=32m $JAVA_OPTS"
JAVA_OPTS="-XX:MaxPermSize=128m $JAVA_OPTS"
...


Please, play around with those parameter settings!
This can be crucial for your production performance (not only for PermSize
problem in your development environment).

Regards,
  Slobodan Vujasinovic


-----Original Message-----
From: Petr Stehlik [mailto:pstehlik@...]
Sent: Tuesday, 18 December, 2007 11:25
To: enhydra@...
Subject: Re: [enhydra] New enhydra releases

Slobodan Vujasinovic wrote:
> Hi,

Slobodan,

> You are right, tomcat documentation, manager and host-manager are not
> included in enhydra runtime distribution. This is bug in our build
> procedure and it will be fixed in next enhydra release!

Very good.

> Also, you are right about "configureBase" shell script (it is not
> upgraded to the latest directory changes introduced with Tomcat 6.0).

I see. BTW, I was hoping the Tomcat 6 will finally resolve the OutOfMemory
problem (PermGen space) that Enhydra is suffering from ever since (it's
actually a JDK bug, most probably) but it still happens after several
deploy/undeploys..

> This scenario can be useful if you are having multiple enhydra
> instances running on the same physical machine but (of course) using
> different connection and shutdown ports (easier maintenance and lower
> hard disk requirements).
>
> "configureBase" allows you create and configure such (CATALINA_BASE)
> directories!

This sounds great. I'll try to remember such easy and clear explanation but
if you added it to the README.txt it would be even better (as I tend to
forget everything :-)

> Regarding "configure" shell script, it should be executed with "-jdk.dir"
> parameter!

The README.txt says:
======================
To configure the enhydra distribution:

cd to '<enhydra_root>/multiserver/enhydra' directory and type in the
following command:

configure    (Windows)

./configure  (Linux)
======================

So no mention of -jdk.dir...

Also, few lines below where you explain how to prepare the build.properties
file you say:

"jdk.dir - the path to your installation of the Java Development Kit
(obligational if environment variable JAVA_HOME isn't (properly) defined)"

So basically the -jdk.dir is not documented as a requirement for correct
configuration.

> In our next release, we'll also implement $JAVA_HOME environment
> variable recognition.

Something as simple as the following patch would work:

--- multiserver/enhydra/configure.old   2007-10-26 18:37:38.000000000 +0200
+++ multiserver/enhydra/configure       2007-12-18 10:09:43.000000000 +0100
@@ -99,7 +99,6 @@
         then
                 JAVA_HOME=$(expr "x$param" : 'x[^=]*=\(.*\)')
                 export JAVA_HOME
-               jdk_DOT_dir=$JAVA_HOME
                 continue
         fi

@@ -315,6 +314,7 @@

  done

+jdk_DOT_dir=$JAVA_HOME

  export PATH=$JAVA_HOME/bin:$PATH


> Thank you very much for those problem reports!
> We'll resolve those issues for our next release.

Thanks for your great work on TAS/TDS.

Petr






--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Re: New enhydra releases

by Petr Stehlik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Slobodan Vujasinovic wrote:
> "OutOfMemory" should be easy to resolve!

Unfortunately it's not. Try to google for "permgen tomcat" if you wish.
In short, Tomcat does not manage to release the loaded classes from
memory on undeploy so the PermGen is slowly increasing until you run out
of that. It's not Tomcat bug and it's not SUN JVM bug but they say that
with other JVMs this problem does not occur.

And I've read that Tomcat 6 somehow worked around it. Ah, but they seem
to introduce another bug with similar effect:

http://www.mail-archive.com/users@.../msg29820.html

BTW, Slobodan, I cannot find "EnhydraManager" application in the TAS
package. Perhaps it's packaged somewhere else, I just read about it in
the documentation and thought it would be worth trying out.

Petr




--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

RE: New enhydra releases

by Slobodan Vujasinovic-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This will not resolve class releasing problem of the tomcat but can postpone
its negative effect :)

"Enhydra Manager" is not a part of the community package - sorry!


Slobodan Vujasinovic
---------------------------------
PROZONE d.o.o.
21000 Novi Sad
Dunavska 13

tel:    +381-21-4720-200
fax:    +381-21-451-216
mobile: +381-63-1073-978
email:  slobodan.vujasinovic@...
web:    www.prozone.co.yu
---------------------------------


-----Original Message-----
From: Petr Stehlik [mailto:pstehlik@...]
Sent: Tuesday, 18 December, 2007 13:28
To: enhydra@...
Subject: Re: [enhydra] New enhydra releases

Slobodan Vujasinovic wrote:
> "OutOfMemory" should be easy to resolve!

Unfortunately it's not. Try to google for "permgen tomcat" if you wish.
In short, Tomcat does not manage to release the loaded classes from memory
on undeploy so the PermGen is slowly increasing until you run out of that.
It's not Tomcat bug and it's not SUN JVM bug but they say that with other
JVMs this problem does not occur.

And I've read that Tomcat 6 somehow worked around it. Ah, but they seem to
introduce another bug with similar effect:

http://www.mail-archive.com/users@.../msg29820.html

BTW, Slobodan, I cannot find "EnhydraManager" application in the TAS
package. Perhaps it's packaged somewhere else, I just read about it in the
documentation and thought it would be worth trying out.

Petr






--
You receive this message as a subscriber of the enhydra@... mailing list.
To unsubscribe: mailto:enhydra-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws