il faut voir au niveau upgrade to RC5, ClassCastException on getCollectionByQuery

2004-02-06 Thread Reda Benzair
Raymond Barlow wrote:

Hi Armin,

I found Jacob's fixes and incorporated them into my local source 
branch, rebuilt jars etc, and now it all works!!

Thanks Armin. Thanks Jacob.

-Raymond

Armin Waibel wrote:

Hi Raymond,

Jakob has checked in a fix. Will be included
in the upcoming 1.0 version.
regards,
Armin
Armin Waibel wrote:

Hi,

[EMAIL PROTECTED] wrote:

Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not 
instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.

This worked for rc3, I guess there's been changes around that 
since. Does




yes, I think the prefetching mechanism was added since rc3

this mean that I now need to descend all my custom list classes from
Collection?




hmm, I don't implement this new part, but I assume it's a bug, 
because I can't find an note in the release-notes that now all 
collection-class need to be instance of collection. And this 
wouldn't be make sense because in repository.dtd we say
"This attribute must only specified if the attribute type is not a 
java.util.Collection (or subclass) or Array type."

I will try to add a test case for this problem.

regards,
Armin
-Raymond


Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection)
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}
Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee

name="contracts"

element-class-ref="com.hours28.domain.entity.EmployeeContract"
 collection-class="com.hours28.domain.entity.EmployeeContractCollection" 

auto-retreive="true"
auto-update="true">

 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"
collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection" 

auto-retreive="true"
auto-update="true">

 
Are both classes EmployeeContractCollection,
EmployeeServiceDetailCollection instance of Collection?
regards,
Armin
Raymond Barlow wrote:


Hi Armin,




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
*Reda BENZAIR**
*Software Analyst
***
*Phone: +33 (0)1 4996 6324
Fax: +33 (0)1 4996 6405
Mobile: +33 (0)6 6240 6192
[EMAIL PROTECTED] 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


dernier réponse :::: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-02-06 Thread Reda Benzair
Armin Waibel wrote:

Hi Raymond,

Jakob has checked in a fix. Will be included
in the upcoming 1.0 version.
regards,
Armin
Armin Waibel wrote:

Hi,

[EMAIL PROTECTED] wrote:

Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not 
instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.

This worked for rc3, I guess there's been changes around that since. 
Does


yes, I think the prefetching mechanism was added since rc3

this mean that I now need to descend all my custom list classes from
Collection?


hmm, I don't implement this new part, but I assume it's a bug, 
because I can't find an note in the release-notes that now all 
collection-class need to be instance of collection. And this wouldn't 
be make sense because in repository.dtd we say
"This attribute must only specified if the attribute type is not a 
java.util.Collection (or subclass) or Array type."

I will try to add a test case for this problem.

regards,
Armin
-Raymond


Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection)
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}
Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee

name="contracts"
element-class-ref="com.hours28.domain.entity.EmployeeContract"
 collection-class="com.hours28.domain.entity.EmployeeContractCollection" 

auto-retreive="true"
auto-update="true">

 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"
collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection" 

auto-retreive="true"
auto-update="true">

 
Are both classes EmployeeContractCollection,
EmployeeServiceDetailCollection instance of Collection?
regards,
Armin
Raymond Barlow wrote:


Hi Armin,



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
*Reda BENZAIR**
*Software Analyst
***
*Phone: +33 (0)1 4996 6324
Fax: +33 (0)1 4996 6405
Mobile: +33 (0)6 6240 6192
[EMAIL PROTECTED] 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-13 Thread Raymond Barlow
Hi Armin,

I found Jacob's fixes and incorporated them into my local source branch, 
rebuilt jars etc, and now it all works!!

Thanks Armin. Thanks Jacob.

-Raymond

Armin Waibel wrote:

Hi Raymond,

Jakob has checked in a fix. Will be included
in the upcoming 1.0 version.
regards,
Armin
Armin Waibel wrote:

Hi,

[EMAIL PROTECTED] wrote:

Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not 
instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.

This worked for rc3, I guess there's been changes around that since. 
Does


yes, I think the prefetching mechanism was added since rc3

this mean that I now need to descend all my custom list classes from
Collection?


hmm, I don't implement this new part, but I assume it's a bug, 
because I can't find an note in the release-notes that now all 
collection-class need to be instance of collection. And this wouldn't 
be make sense because in repository.dtd we say
"This attribute must only specified if the attribute type is not a 
java.util.Collection (or subclass) or Array type."

I will try to add a test case for this problem.

regards,
Armin
-Raymond


Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection)
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}
Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee

name="contracts"
element-class-ref="com.hours28.domain.entity.EmployeeContract"
 collection-class="com.hours28.domain.entity.EmployeeContractCollection" 

auto-retreive="true"
auto-update="true">

 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"
collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection" 

auto-retreive="true"
auto-update="true">

 
Are both classes EmployeeContractCollection,
EmployeeServiceDetailCollection instance of Collection?
regards,
Armin
Raymond Barlow wrote:


Hi Armin,



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Regards,
Raymond Barlow


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-12 Thread Armin Waibel
Hi Raymond,

Jakob has checked in a fix. Will be included
in the upcoming 1.0 version.
regards,
Armin
Armin Waibel wrote:
Hi,

[EMAIL PROTECTED] wrote:

Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not 
instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.

This worked for rc3, I guess there's been changes around that since. Does


yes, I think the prefetching mechanism was added since rc3

this mean that I now need to descend all my custom list classes from
Collection?


hmm, I don't implement this new part, but I assume it's a bug, because I 
can't find an note in the release-notes that now all collection-class 
need to be instance of collection. And this wouldn't be make sense 
because in repository.dtd we say
"This attribute must only specified if the attribute type is not a 
java.util.Collection (or subclass) or Array type."

I will try to add a test case for this problem.

regards,
Armin
-Raymond


Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection)
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}
Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee


 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"
collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection" 

auto-retreive="true"
auto-update="true">

 
Are both classes EmployeeContractCollection,
EmployeeServiceDetailCollection instance of Collection?
regards,
Armin
Raymond Barlow wrote:


Hi Armin,


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-12 Thread Armin Waibel
Hi,

[EMAIL PROTECTED] wrote:

Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.
This worked for rc3, I guess there's been changes around that since. Does
yes, I think the prefetching mechanism was added since rc3

this mean that I now need to descend all my custom list classes from
Collection?
hmm, I don't implement this new part, but I assume it's a bug, because I 
can't find an note in the release-notes that now all collection-class 
need to be instance of collection. And this wouldn't be make sense 
because in repository.dtd we say
"This attribute must only specified if the attribute type is not a 
java.util.Collection (or subclass) or Array type."

I will try to add a test case for this problem.

regards,
Armin
-Raymond


Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection)
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}
Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee


 
 

 
Are both classes EmployeeContractCollection,
EmployeeServiceDetailCollection instance of Collection?
regards,
Armin
Raymond Barlow wrote:


Hi Armin,


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-12 Thread rbarlow
Hi Armin,

Ah, right yes, that would make sense. Those 2 classes are not instances of
Collection. They descend from java.lang.Object (ie. does not extend
anything). The implement ManagableCollection.

This worked for rc3, I guess there's been changes around that since. Does
this mean that I now need to descend all my custom list classes from
Collection?

-Raymond

> Hi Raymond,
>
> the error occured in method prefetchRelationship(Collection owners)
> line 149 when a cast for the 1:n references is done.
> The cast is
>
> if (collectionClass != null)
> {
> newChildren = (Collection)
> broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
> }
>
> Thus I think OJB has problems with one of your collection class in
> class-descriptor of Employee
>
>   name="contracts"
>  element-class-ref="com.hours28.domain.entity.EmployeeContract"
>   collection-class="com.hours28.domain.entity.EmployeeContractCollection"
>  auto-retreive="true"
>  auto-update="true">
>  
>   
>
> name="employeeServiceDetails"
> element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"
> collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection"
>  auto-retreive="true"
>  auto-update="true">
>  
>   
>
> Are both classes EmployeeContractCollection,
> EmployeeServiceDetailCollection instance of Collection?
>
> regards,
> Armin
>
> Raymond Barlow wrote:
>
>> Hi Armin,

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-12 Thread Armin Waibel
Hi Raymond,

the error occured in method prefetchRelationship(Collection owners)
line 149 when a cast for the 1:n references is done.
The cast is
if (collectionClass != null)
{
   newChildren = (Collection) 
broker.getCollectionByQuery(collectionClass, queries[i]); //Line 149
}

Thus I think OJB has problems with one of your collection class in
class-descriptor of Employee


 
 
name="employeeServiceDetails" 
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail" 
collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection"
auto-retreive="true"
auto-update="true">

 

Are both classes EmployeeContractCollection, 
EmployeeServiceDetailCollection instance of Collection?

regards,
Armin
Raymond Barlow wrote:

Hi Armin,

Since my my lsat post, I've found that this is something to do with 
polymorphic classes/extents. I've basically got a base "User" class, and 
descendingt from that are 2 classes "Supplier" and "Employee". "User" is 
an abstract class, and the only "Supplier" and "Employee" are concrete 
classes. Thus, there is no table for "User". "Employee" and "Supplier" 
map to their own tables. I will recompile the jars, but until then, here 
are the class-descriptors for the 3 classes:

  
 
 
  
  
class="com.hours28.domain.entity.Employee"
table="Employee">
 
name="oid"
column="employeeId"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"/>
 
name="userName"
column="userName"
jdbc-type="VARCHAR"/>
 
name="password"
column="password"
jdbc-type="VARCHAR"/>
 
name="restricted"
column="restricted"
jdbc-type="BIT"/>
 
name="notes"
column="notes"
jdbc-type="VARCHAR"/>
 
name="imageStoredFileId"
column="imageStoredFileId"
jdbc-type="INTEGER"/>
 
name="image"
class-ref="com.hours28.domain.entity.StoredFile">

 
 
name="securityLevelId"
column="securityLevelId"
jdbc-type="INTEGER"/>
 
name="securityLevel"
class-ref="com.hours28.domain.entity.SecurityLevel">

 
 
name="devices"
element-class-ref="com.hours28.domain.entity.ContactDevice"
auto-retrieve="true"
auto-update="true"
indirection-table="EmployeeContactDevice">


 
 
name="addresses"
element-class-ref="com.hours28.domain.entity.Address"
auto-retrieve="true"
auto-update="true"
indirection-table="EmployeeAddress">


 
 
name="jobTitle"
column="jobTitle"
jdbc-type="VARCHAR"/>
 
name="startedWork"
column="startedWork"
jdbc-type="DATE"/>
 
name="title"
column="title"
jdbc-type="VARCHAR"/>
 
name="firstNames"
column="firstNames"
jdbc-type="VARCHAR"/>
 
name="lastName"
column="lastName"
jdbc-type="VARCHAR"/>
 
name="dateOfBirth"
column="dateOfBirth"
jdbc-type="DATE"/>
 
name="companyId"
column="companyId"
jdbc-type="INTEGER"
access="anonymous"/>
 
name="company"
class-ref="com.hours28.domain.entity.Company">

 
 
name="interests"
column="interests"
jdbc-type="VARCHAR"/>
 
name="contracts"
element-class-ref="com.hours28.domain.entity.EmployeeContract"

collection-class="com.hours28.domain.entity.EmployeeContractCollection"
auto-retreive="true"
auto-update="true">

 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"

collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection" 

auto-retreive="true"
auto-update="true">

 
  
  
 
 
 
 
 
 
 

 
 
 

 
 


 
 


 
 
 
 
 

 
 
 
 
 
  
It has something to

Armin Waibel wrote:

Hi Raymond,

> I suspect it is something still hanging around from rc3 in my paths.
> I've updated all the relevant jars (that I can think of), the
> OJB.properties, the repository xml files etc.
ok, that's all you can do.
hmm, your code works with rc3 and don't work with rc5 - right?
If so, sounds like a bug in rc5.
Make OJB jars with target 'jar-debug' instead 'jar', then the line 
numbers will be included in stack trace.

Could you post the class-descriptor for Employee?
I will try to write a test case for your problem.
regards,
Armin
Raymond Barlow wrote:

Hi all,

I've been chasing this all day, and have gotten no further *sigh*.

Why does the fol

Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-11 Thread Raymond Barlow
And here's the stack trace with line numbers:

org.apache.ojb.broker.PersistenceBrokerException: 
java.lang.ClassCastException
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:251)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:263)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:997)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:322)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:322)
   at com.hours28.test.TempTest.test1(TempTest.java:42)
   at com.hours28.test.TempTest.main(TempTest.java:30)
Caused by: java.lang.ClassCastException
   at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(BasePrefetcher.java:149)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryReferenceBroker.java:317)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:187)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:244)
   ... 6 more

Thanks for your help!

-Raymond

Armin Waibel wrote:

Hi Raymond,

> I suspect it is something still hanging around from rc3 in my paths.
> I've updated all the relevant jars (that I can think of), the
> OJB.properties, the repository xml files etc.
ok, that's all you can do.
hmm, your code works with rc3 and don't work with rc5 - right?
If so, sounds like a bug in rc5.
Make OJB jars with target 'jar-debug' instead 'jar', then the line 
numbers will be included in stack trace.

Could you post the class-descriptor for Employee?
I will try to write a test case for your problem.
regards,
Armin
Raymond Barlow wrote:

Hi all,

I've been chasing this all day, and have gotten no further *sigh*.

Why does the following code give me a ClassCastException on the 
getCollectionByQuery??

 PersistenceBroker broker = null;
   Criteria criteria = new Criteria();
   criteria.addEqualTo("userName", "test");
   Query query = new QueryByCriteria(Employee.class, criteria);
   try
   {
   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
//dies on this line:
   Collection results = broker.getCollectionByQuery(query);
   Vector v = new Vector();
   v.addAll(results);
   Employee u = (Employee)v.get(0);
   System.out.println(u.getUserName());
   }
   catch (Throwable t)
   {
   t.printStackTrace();
   }
   finally
   {
   if(broker != null)
   broker.close();
   }
stack trace:
org.apache.ojb.broker.PersistenceBrokerException: 
java.lang.ClassCastException
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at com.hours28.test.TempTest.test1(TempTest.java:40)
   at com.hours28.test.TempTest.main(TempTest.java:28)
Caused by: java.lang.ClassCastException
   at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   ... 7 more

I suspect it is something still hanging around from rc3 in my paths. 
I've updated all the relevant jars (that I can think of), the 
OJB.properties, the repository xml files etc.

Another strange thing about this is that if I run this twice (ie, 
after the exception, try it again without restarting the session), it 
works. Strange. It seems like it just doesn't load classes correctly 
on the first search for them.

Any suggestions?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Regards,
Raymond Barlow


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-11 Thread Raymond Barlow
Hi Armin,

Since my my lsat post, I've found that this is something to do with 
polymorphic classes/extents. I've basically got a base "User" class, and 
descendingt from that are 2 classes "Supplier" and "Employee". "User" is 
an abstract class, and the only "Supplier" and "Employee" are concrete 
classes. Thus, there is no table for "User". "Employee" and "Supplier" 
map to their own tables. I will recompile the jars, but until then, here 
are the class-descriptors for the 3 classes:

  
 
 
  
  
class="com.hours28.domain.entity.Employee"
table="Employee">
 
name="oid"
column="employeeId"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"/>
 
name="userName"
column="userName"
jdbc-type="VARCHAR"/>
 
name="password"
column="password"
jdbc-type="VARCHAR"/>
 
name="restricted"
column="restricted"
jdbc-type="BIT"/>
 
name="notes"
column="notes"
jdbc-type="VARCHAR"/>
 
name="imageStoredFileId"
column="imageStoredFileId"
jdbc-type="INTEGER"/>
 
name="image"
class-ref="com.hours28.domain.entity.StoredFile">

 
 
name="securityLevelId"
column="securityLevelId"
jdbc-type="INTEGER"/>
 
name="securityLevel"
class-ref="com.hours28.domain.entity.SecurityLevel">

 
 
name="devices"
element-class-ref="com.hours28.domain.entity.ContactDevice"
auto-retrieve="true"
auto-update="true"
indirection-table="EmployeeContactDevice">


 
 
name="addresses"
element-class-ref="com.hours28.domain.entity.Address"
auto-retrieve="true"
auto-update="true"
indirection-table="EmployeeAddress">


 
 
name="jobTitle"
column="jobTitle"
jdbc-type="VARCHAR"/>
 
name="startedWork"
column="startedWork"
jdbc-type="DATE"/>
 
name="title"
column="title"
jdbc-type="VARCHAR"/>
 
name="firstNames"
column="firstNames"
jdbc-type="VARCHAR"/>
 
name="lastName"
column="lastName"
jdbc-type="VARCHAR"/>
 
name="dateOfBirth"
column="dateOfBirth"
jdbc-type="DATE"/>
 
name="companyId"
column="companyId"
jdbc-type="INTEGER"
access="anonymous"/>
 
name="company"
class-ref="com.hours28.domain.entity.Company">

 
 
name="interests"
column="interests"
jdbc-type="VARCHAR"/>
 
name="contracts"
element-class-ref="com.hours28.domain.entity.EmployeeContract"

collection-class="com.hours28.domain.entity.EmployeeContractCollection"
auto-retreive="true"
auto-update="true">

 
 
name="employeeServiceDetails"
element-class-ref="com.hours28.domain.entity.EmployeeServiceDetail"

collection-class="com.hours28.domain.entity.EmployeeServiceDetailCollection"
auto-retreive="true"
auto-update="true">

 
  

  
 
 
 
 
 
 
 

 
 
 

 
 


 
 


 
 
 
 
 

 
 
 
 
 
  
It has something to

Armin Waibel wrote:

Hi Raymond,

> I suspect it is something still hanging around from rc3 in my paths.
> I've updated all the relevant jars (that I can think of), the
> OJB.properties, the repository xml files etc.
ok, that's all you can do.
hmm, your code works with rc3 and don't work with rc5 - right?
If so, sounds like a bug in rc5.
Make OJB jars with target 'jar-debug' instead 'jar', then the line 
numbers will be included in stack trace.

Could you post the class-descriptor for Employee?
I will try to write a test case for your problem.
regards,
Armin
Raymond Barlow wrote:

Hi all,

I've been chasing this all day, and have gotten no further *sigh*.

Why does the following code give me a ClassCastException on the 
getCollectionByQuery??

 PersistenceBroker broker = null;
   Criteria criteria = new Criteria();
   criteria.addEqualTo("userName", "test");
   Query query = new QueryByCriteria(Employee.class, criteria);
   try
   {
   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
//dies on this line:
   Collection results = broker.getCollectionByQuery(query);
   Vector v = new Vector();
   v.addAll(results);
   Employee u = (Employee)v.get(0);
   System.out.println(u.getUserName());
   }
   catch (Throwable t)
   {
   t.printStackTrace();
   }
   finally
   {
   if(broker != null)
   broker.close();
   }
stack tr

Re: upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-11 Thread Armin Waibel
Hi Raymond,

> I suspect it is something still hanging around from rc3 in my paths.
> I've updated all the relevant jars (that I can think of), the
> OJB.properties, the repository xml files etc.
ok, that's all you can do.
hmm, your code works with rc3 and don't work with rc5 - right?
If so, sounds like a bug in rc5.
Make OJB jars with target 'jar-debug' instead 'jar', then the line 
numbers will be included in stack trace.

Could you post the class-descriptor for Employee?
I will try to write a test case for your problem.
regards,
Armin
Raymond Barlow wrote:
Hi all,

I've been chasing this all day, and have gotten no further *sigh*.

Why does the following code give me a ClassCastException on the 
getCollectionByQuery??

 PersistenceBroker broker = null;
   Criteria criteria = new Criteria();
   criteria.addEqualTo("userName", "test");
   Query query = new QueryByCriteria(Employee.class, criteria);
   try
   {
   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
//dies on this line:
   Collection results = broker.getCollectionByQuery(query);
   Vector v = new Vector();
   v.addAll(results);
   Employee u = (Employee)v.get(0);
   System.out.println(u.getUserName());
   }
   catch (Throwable t)
   {
   t.printStackTrace();
   }
   finally
   {
   if(broker != null)
   broker.close();
   }
stack trace:
org.apache.ojb.broker.PersistenceBrokerException: 
java.lang.ClassCastException
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at com.hours28.test.TempTest.test1(TempTest.java:40)
   at com.hours28.test.TempTest.main(TempTest.java:28)
Caused by: java.lang.ClassCastException
   at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   ... 7 more

I suspect it is something still hanging around from rc3 in my paths. 
I've updated all the relevant jars (that I can think of), the 
OJB.properties, the repository xml files etc.

Another strange thing about this is that if I run this twice (ie, after 
the exception, try it again without restarting the session), it works. 
Strange. It seems like it just doesn't load classes correctly on the 
first search for them.

Any suggestions?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


upgrade to RC5, ClassCastException on getCollectionByQuery

2004-01-11 Thread Raymond Barlow
Hi all,

I've been chasing this all day, and have gotten no further *sigh*.

Why does the following code give me a ClassCastException on the 
getCollectionByQuery??

 PersistenceBroker broker = null;
   Criteria criteria = new Criteria();
   criteria.addEqualTo("userName", "test");
   Query query = new QueryByCriteria(Employee.class, criteria);
   try
   {
   broker = PersistenceBrokerFactory.defaultPersistenceBroker();
//dies on this line:
   Collection results = broker.getCollectionByQuery(query);
   Vector v = new Vector();
   v.addAll(results);
   Employee u = (Employee)v.get(0);
   System.out.println(u.getUserName());
   }
   catch (Throwable t)
   {
   t.printStackTrace();
   }
   finally
   {
   if(broker != null)
   broker.close();
   }
stack trace:
org.apache.ojb.broker.PersistenceBrokerException: 
java.lang.ClassCastException
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at com.hours28.test.TempTest.test1(TempTest.java:40)
   at com.hours28.test.TempTest.main(TempTest.java:28)
Caused by: java.lang.ClassCastException
   at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(Unknown 
Source)
   at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown 
Source)
   ... 7 more

I suspect it is something still hanging around from rc3 in my paths. 
I've updated all the relevant jars (that I can think of), the 
OJB.properties, the repository xml files etc.

Another strange thing about this is that if I run this twice (ie, after 
the exception, try it again without restarting the session), it works. 
Strange. It seems like it just doesn't load classes correctly on the 
first search for them.

Any suggestions?

--
Regards,
Raymond Barlow


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]