Oliver Hoff | 2 Jun 10:31 2003
Picon

[OJB] Issue #OJB175 - java.lang.Long-ClassCast-Exception in OJB-Sequence-Manager H...

You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/OJB175>

Type :        Defect
Issue Id :    OJB175
Reported by: Oliver Hoff
             olimolli - (hoff <at> lh2.de)

Details:

Platform: DEC
Operating system: windows 2000
Summary: java.lang.Long-ClassCast-Exception in OJB-Sequence-Manager High-Low-Implementation
Description: Hi,

I'm using OJB for some time. Now I made an update to Version 1.0RC3.

It does not work directly, so I debugged a little bit threw the code and I think I found some bugs  in it:
1) I needed to change in repository_internal the JDBC-Type for the field MAX_KEY in the table OJB_HL_SEQ.
Otherwise I got a java.lang.Long-ClassCast-Exception.
I used the following SequenceManager:
                <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
                    <attribute attribute-name="grabSize" attribute-value="2"/>
                    <attribute attribute-name="autoNaming" attribute-value="true"/>
                    <attribute attribute-name="globalSequenceId" attribute-value="true"/>
                    <attribute attribute-name="globalSequenceStart" attribute-value="15000"/>
                </sequence-manager>

2) Because of this I run into a bug in the class StatementManager in the method bindUpdate:
In the third part, where you set the parameters for WHERE-clause locking, you get the SQLType with the class
(Continue reading)

thma | 2 Jun 14:52 2003
Picon

cvs commit: db-ojb/src/java/org/apache/ojb/broker Identity.java

thma        2003/06/02 05:52:29

  Modified:    src/test/org/apache/ojb/broker/metadata MetadataTest.java
               src/test/org/apache/ojb/broker MultipleDBTest.java
                        MtoNMapping.java FarAwayReference.java
               src/java/org/apache/ojb/otm/lock IsolationFactory.java
               src/java/org/apache/ojb/otm/core BaseConnection.java
               src/test/org/apache/ojb/otm LockTestBase.java
               src/java/org/apache/ojb/broker Identity.java
  Log:
  removed unused import statements

  Revision  Changes    Path
  1.10      +0 -1      db-ojb/src/test/org/apache/ojb/broker/metadata/MetadataTest.java

  Index: MetadataTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/MetadataTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MetadataTest.java	24 May 2003 01:41:59 -0000	1.9
  +++ MetadataTest.java	2 Jun 2003 12:52:28 -0000	1.10
   <at>  <at>  -5,7 +5,6  <at>  <at> 
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.query.Criteria;
(Continue reading)

Thomas Mahler | 2 Jun 15:08 2003
Picon

just say no to unused imports !

Dear committers,

I just removed several unused import statements.
Sure, an unused import statement is not a big deal.
But some time ago we agreed to keep our code free of them.

So, when you check in some code, please make sure there are no unused 
imports in it.

Another common problem with import statements:
To provide JDK 1.2 compatibility we ship a special proxy.jar that 
contains a JDK1.2 replacement of the JDK1.3 and later dynamic proxies.

To enable the usage of these proxies we use preprocessor switches that 
activate the proper import statements, as in the following example:

//#ifdef JDK13
import java.lang.reflect.Proxy;
//#else
/*
import com.develop.java.lang.reflect.Proxy;
*/
//#endif

If a file contains such a section, please do not use IDE features like 
"organize imports" in Eclipse. They won't care for the switches and make 
the file unusable for JDK1.2.

Thanks!
Thomas
(Continue reading)

thma | 2 Jun 17:17 2003
Picon

cvs commit: db-ojb/src/test/org/apache/ojb/quick-db OJB.properties OJB.script

thma        2003/06/02 08:17:36

  Modified:    src/test/org/apache/ojb/quick-db OJB.properties OJB.script
  Log:
  update to latest versio of testdata

  Revision  Changes    Path
  1.19      +1 -1      db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties

  Index: OJB.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- OJB.properties	15 May 2003 21:02:17 -0000	1.18
  +++ OJB.properties	2 Jun 2003 15:17:35 -0000	1.19
   <at>  <at>  -1,5 +1,5  <at>  <at> 
   #HSQL database
  -#Thu May 15 22:16:03 CEST 2003
  +#Mon Jun 02 15:13:18 CEST 2003
   sql.strict_fk=true
   readonly=false
   sql.strong_fk=true

  

  1.20      +4 -3      db-ojb/src/test/org/apache/ojb/quick-db/OJB.script

  Index: OJB.script
(Continue reading)

thma | 2 Jun 17:18 2003
Picon

cvs commit: db-ojb/src/test/org/apache/ojb/odmg UserTestCases.java

thma        2003/06/02 08:18:00

  Modified:    src/test/org/apache/ojb/broker PerformanceTest.java
                        ProxyExamples.java MultipleDBTest.java
                        ObjectCacheTest.java
               src/test/org/apache/ojb/odmg UserTestCases.java
  Log:
  eliminate calls to deprecated API

  Revision  Changes    Path
  1.10      +1 -1      db-ojb/src/test/org/apache/ojb/broker/PerformanceTest.java

  Index: PerformanceTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PerformanceTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PerformanceTest.java	8 Apr 2003 20:19:27 -0000	1.9
  +++ PerformanceTest.java	2 Jun 2003 15:18:00 -0000	1.10
   <at>  <at>  -168,7 +168,7  <at>  <at> 
           for (int i = 0; i < articleCount; i++)
           {
               Object[] pks = {new Integer(offsetId + i)};
  -            Identity oid = new Identity(PerformanceArticle.class, pks);
  +            Identity oid = new Identity(PerformanceArticle.class, PerformanceArticle.class,pks);

               PerformanceArticle a = (PerformanceArticle) broker.getObjectByIdentity(oid);
           }

(Continue reading)

arminw | 3 Jun 02:05 2003
Picon

cvs commit: db-ojb/src/ejb/org/apache/ojb/ejb CommonTestClient.java VOHelper.java CategoryVO.java ArticleVO.java ArticleManagerPBBean.java AllTests.java

arminw      2003/06/02 17:05:37

  Modified:    src/ejb/org/apache/ojb/ejb VOHelper.java CategoryVO.java
                        ArticleVO.java ArticleManagerPBBean.java
                        AllTests.java
  Added:       src/ejb/org/apache/ojb/ejb CommonTestClient.java
  Log:
  add new test case using references

  Revision  Changes    Path
  1.6       +12 -2     db-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java

  Index: VOHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- VOHelper.java	10 Jan 2003 16:52:22 -0000	1.5
  +++ VOHelper.java	3 Jun 2003 00:05:37 -0000	1.6
   <at>  <at>  -88,11 +88,21  <at>  <at> 

       public static ArticleVO createNewArticle(int counter)
       {
  +        return createNewArticle("A simple test article ", counter);
  +    }
  +
  +    public static ArticleVO createNewArticle(String name, int counter)
  +    {
           ArticleVO a = new ArticleVO();
(Continue reading)

arminw | 3 Jun 02:10 2003
Picon

cvs commit: db-ojb/src/test/org/apache/ojb repository_ejb.xml

arminw      2003/06/02 17:10:46

  Modified:    src/test/org/apache/ojb repository_ejb.xml
  Log:
  prepare for new test

  Revision  Changes    Path
  1.2       +6 -6      db-ojb/src/test/org/apache/ojb/repository_ejb.xml

  Index: repository_ejb.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_ejb.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- repository_ejb.xml	10 Jan 2003 16:51:25 -0000	1.1
  +++ repository_ejb.xml	3 Jun 2003 00:10:46 -0000	1.2
   <at>  <at>  -84,8 +84,8  <at>  <at> 
           name="category"
           class-ref="org.apache.ojb.ejb.CategoryVO"
           auto-retrieve="false"
  -        auto-update="true"
  -        auto-delete="true"
  +        auto-update="false"
  +        auto-delete="false"
           >
               <foreignkey field-ref="categoryId"/>
           </reference-descriptor>
   <at>  <at>  -103,7 +103,7  <at>  <at> 
         table="EJB_CATEGORY"
(Continue reading)

arminw | 3 Jun 02:12 2003
Picon

cvs commit: db-ojb/src/test/org/apache/ojb/broker CollectionTest.java

arminw      2003/06/02 17:12:48

  Modified:    src/test/org/apache/ojb repository_junit.xml
               src/test/org/apache/ojb/odmg CollectionsTest.java
  Added:       src/test/org/apache/ojb/broker CollectionTest.java
  Log:
  add new test case

  Revision  Changes    Path
  1.68      +194 -0    db-ojb/src/test/org/apache/ojb/repository_junit.xml

  Index: repository_junit.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit.xml,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- repository_junit.xml	30 May 2003 16:05:44 -0000	1.67
  +++ repository_junit.xml	3 Jun 2003 00:12:48 -0000	1.68
   <at>  <at>  -3890,6 +3890,200  <at>  <at> 
           </reference-descriptor>
       </class-descriptor>

  +
  +
  +<!-- ************************************************* -->
  +<!--      PB collection test objects                   -->
  +<!-- ************************************************* -->
  +
  +    <!--
(Continue reading)

thma | 3 Jun 11:20 2003
Picon

cvs commit: db-ojb build.xml

thma        2003/06/03 02:20:53

  Modified:    src/test/org/apache/ojb repository.xml
               .        build.xml
  Log:
  Providing A PUBLIC identifier to repository xml, as recommended by James Holmes.
  Also provided a public url for the dtd

  Revision  Changes    Path
  1.17      +24 -6     db-ojb/src/test/org/apache/ojb/repository.xml

  Index: repository.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- repository.xml	30 Mar 2003 20:13:00 -0000	1.16
  +++ repository.xml	3 Jun 2003 09:20:52 -0000	1.17
   <at>  <at>  -1,9 +1,25  <at>  <at> 
   <?xml version="1.0" encoding="UTF-8"?>
  -<!-- This is a sample metadata repository for the ObJectBridge System.
  -     Use this file as a template for building your own mappings-->
  -
  -<!-- defining entities for include-files -->
  -<!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
  +<!-- This is a sample metadata repository for the 
  +     Apache ObJectRelationalBridge (OJB) System.
  +     Use this file as a template for building your own mappings.
  +-->
(Continue reading)

Thomas Mahler | 3 Jun 11:27 2003
Picon

Re: repository xml and DTDs

Hi again James,

I just checked in a change to the OJB repository.xml.
We now have a PUBLIC identifier as follows:

<!DOCTYPE descriptor-repository PUBLIC
        "-//Apache Software Foundation//DTD OJB Repository//EN"
        "repository.dtd"
[
<!ENTITY database SYSTEM "repository_database.xml">
<!ENTITY internal SYSTEM "repository_internal.xml">
<!ENTITY junit SYSTEM "repository_junit.xml">
<!ENTITY user SYSTEM "repository_user.xml">
<!ENTITY ejb SYSTEM "repository_ejb.xml">
<!ENTITY jdo SYSTEM "repository_jdo.xml">
]>

I decided to use a local System identifier ("repository.dtd") instead of 
a public one by default.
I know OJB will be operated on production environments that cannot 
connect to the internet to access the dtd from the apache site!

Nevertheless I also made the dtd publicly available under:
http://db.apache.org/ojb/dtds/1.0/repository.dtd

So by changing the SYTEM identifier to
"http://db.apache.org/ojb/dtds/1.0/repository.dtd" one can validate 
against the public DTD.

I hope this is OK for your needs!
(Continue reading)


Gmane