Re: Can use tranditional-Chinese in where condition of OQL?

2004-01-08 Thread Thomas Dudziak
Thomas updated the grammar in CVS to antlr 2.7.2 and unicode, so please
grab OJB from CVS, and try your query again.

Tom



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



Problem with reading records having a PK with value 0 (not null)

2004-01-08 Thread Alexandre Morin
Hi,

 

It looks like OJB cannot fetch correctly records which have a BigInt primary
key with value 0; at least in the following conditions;

 

- I'm using RC5

- Have a table (here Locations) with a primary key Id with a auto-increment
sequence

- I'm using Oracle 9.2

- The table has a 1-N collection using a proxy.

 

 

For instance, I have the following mapping:

 

class-descriptor class=Locations table=LOCATIONS

 

field-descriptor name=id column=ID 

jdbc-type=BIGINT primarykey=true 

autoincrement=true 

sequence-name=locations_id_seq/

 

field-descriptor name=latitude column=LATITUDE
jdbc-type=BIGINT/

 

field-descriptor name=longitude column=LONGITUDE
jdbc-type=BIGINT/

...

collection-descriptor name=collElements 

element-class-ref=Elements proxy=true

  inverse-foreignkey field-ref=locationid/

/collection-descriptor

 

  /class-descriptor

 

 

Now in the database, there is a location with Id=0.

When I use OJB to fetch this record (with a criteria on Id=0), the resulting
instance is correct except for the Id field which has the next sequence
value.

 

Tracing the code, what happens is when the query is executed:

 

-  RsIterator.getObjectFromResultSet reteive the simple fields
correctly

-  As there is a collection, retrieveCollections is called

-  The query to retrieve the collection is built: Query fkQuery =
getFKQuery(obj, cld, cds); 

-  This retrieves the PK fields values (getFKQuery1toN ) which
indirectly calls getValuesForObject 

-  When the value for the Id is retrieved (getAutoIncrementValue),
it is considered as Null (BrokerHelper.isNull) and thus the sequence is
called.

 

Can this be considered a bug?

Are there any workarounds?

 

 

Thanks,

 

-Alex

 



Re: Problem with reading records having a PK with value 0 (not null)

2004-01-08 Thread Danilo Tommasina
Hi,

I reported the same issue some months ago...
The problem lies in the support for primitive data types, since a 
primitive type cannot be null, the value 0 is interpreted as null.
It seems that non primitive data types also react the same way (even if 
they shouldn't, so from my point of view it is a bug)

Fetching an object with ID = 0 works, however OJB will handle the 0 
value as null and put the next sequence value into the fetched object on 
next store or when calling a PeristenceBroker.retrieveAllReferencies( 
Object obj )

The workaround is to never use IDs = 0 and this is actually what I am 
doing ;)

bye
Danilo
Hi,

 

It looks like OJB cannot fetch correctly records which have a BigInt primary
key with value 0; at least in the following conditions;
 

- I'm using RC5

- Have a table (here Locations) with a primary key Id with a auto-increment
sequence
- I'm using Oracle 9.2

- The table has a 1-N collection using a proxy.

 

 

For instance, I have the following mapping:

 

class-descriptor class=Locations table=LOCATIONS

 

field-descriptor name=id column=ID 

jdbc-type=BIGINT primarykey=true 

autoincrement=true 

sequence-name=locations_id_seq/

 

field-descriptor name=latitude column=LATITUDE
jdbc-type=BIGINT/
 

field-descriptor name=longitude column=LONGITUDE
jdbc-type=BIGINT/
...

collection-descriptor name=collElements 

element-class-ref=Elements proxy=true

  inverse-foreignkey field-ref=locationid/

/collection-descriptor

 

  /class-descriptor

 

 

Now in the database, there is a location with Id=0.

When I use OJB to fetch this record (with a criteria on Id=0), the resulting
instance is correct except for the Id field which has the next sequence
value.
 

Tracing the code, what happens is when the query is executed:

 

-  RsIterator.getObjectFromResultSet reteive the simple fields
correctly
-  As there is a collection, retrieveCollections is called

-  The query to retrieve the collection is built: Query fkQuery =
getFKQuery(obj, cld, cds); 

-  This retrieves the PK fields values (getFKQuery1toN ) which
indirectly calls getValuesForObject 

-  When the value for the Id is retrieved (getAutoIncrementValue),
it is considered as Null (BrokerHelper.isNull) and thus the sequence is
called.
 

Can this be considered a bug?

Are there any workarounds?

 

 

Thanks,

 

-Alex

 




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


AW: integrity constraint violation

2004-01-08 Thread Dirk Manske (Service Respond)
Hi there,

can anyone give me a hint about my problem (see below)? if I have the
following two tables

*** *
* 
* Table PERSON  *
* Table ACTIVITY*
*-
* _0..1N_   * -
-   *
* personId INTEGER NOT NULL Identity Primary Key*
*  activityId INTEGER NOT NULL Identity Primary Key *
*   *
*  personId INTEGER (foreign key)   *

*...*

with a 0..1-to-many relation. both tables are empty. it should be possible
to create an activity and store it without assigning a person, right?!
However I get a violated constraint exception for table PEERSON, although I
did not setup any value for personId as no row exists in table person. after
traced the exception message I found out, that for the attribute person_id
OJB generated a 0 value and tries to store it and I just read in another
message that there is a 0-null problem for OJB. Am I facing exact this
problem?

help appreciated!

thx,
Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond)
[mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 7. Januar 2004 18:56
An: [EMAIL PROTECTED]
Betreff: integrity constraint violation 



Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with
HSQLDB and have set up a table 'person' with personId as primary key and a
second table 'activity' with this attribute as foreign key (null allowed).
the datatyp is integer and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it.
however, when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.KeyConstraintViolatedException 
java.sql.SqlException: integrity constraint violation for table 'person'.
What am I doing wrong?
 
thx,
Dirk
 


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



Re: Problem with reading records having a PK with value 0 (not null)

2004-01-08 Thread Armin Waibel
Hi Danilo,

Danilo Tommasina wrote:

Hi,

I reported the same issue some months ago...
The problem lies in the support for primitive data types, since a 
primitive type cannot be null, the value 0 is interpreted as null.
It seems that non primitive data types also react the same way (even if 
they shouldn't, so from my point of view it is a bug)
if so, I agree sounds like a bug. Can you post a test case to reproduce 
the problem or describe what to do with pseudo code?

Fetching an object with ID = 0 works, however OJB will handle the 0 
value as null and put the next sequence value into the fetched object on 
next store or when calling a PeristenceBroker.retrieveAllReferencies( 
Object obj )
For OJB 1.1 a complete refactoring of the primitive data types handling 
is scheduled.
Here you can post your proposals for the upcoming 1.1 version

http://nagoya.apache.org/wiki/apachewiki.cgi?OJBProjectPages/OJBOnePointOne



The workaround is to never use IDs = 0 and this is actually what I am 
doing ;)
or don't use primitive data types for PK fields in your pc objects (or 
do both ;-)).

regards,
Armin
bye
Danilo
Hi,

 

It looks like OJB cannot fetch correctly records which have a BigInt 
primary
key with value 0; at least in the following conditions;

 

- I'm using RC5

- Have a table (here Locations) with a primary key Id with a 
auto-increment
sequence

- I'm using Oracle 9.2

- The table has a 1-N collection using a proxy.

 

 

For instance, I have the following mapping:

 

class-descriptor class=Locations table=LOCATIONS

 

field-descriptor name=id column=ID
jdbc-type=BIGINT primarykey=true
autoincrement=true
sequence-name=locations_id_seq/
 

field-descriptor name=latitude column=LATITUDE
jdbc-type=BIGINT/
 

field-descriptor name=longitude column=LONGITUDE
jdbc-type=BIGINT/
...

collection-descriptor name=collElements
element-class-ref=Elements proxy=true
  inverse-foreignkey field-ref=locationid/

/collection-descriptor

 

  /class-descriptor

 

 

Now in the database, there is a location with Id=0.

When I use OJB to fetch this record (with a criteria on Id=0), the 
resulting
instance is correct except for the Id field which has the next sequence
value.

 

Tracing the code, what happens is when the query is executed:

 

-  RsIterator.getObjectFromResultSet reteive the simple fields
correctly
-  As there is a collection, retrieveCollections is called

-  The query to retrieve the collection is built: Query fkQuery =
getFKQuery(obj, cld, cds);
-  This retrieves the PK fields values (getFKQuery1toN ) which
indirectly calls getValuesForObject
-  When the value for the Id is retrieved 
(getAutoIncrementValue),
it is considered as Null (BrokerHelper.isNull) and thus the sequence is
called.

 

Can this be considered a bug?

Are there any workarounds?

 

 

Thanks,

 

-Alex

 




-
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: History of OJB

2004-01-08 Thread Thomas Mahler
Hi Brian,

Brian Sam-Bodden wrote:
Thomas,
   Could you give us a short and sweet version of how OJB came to be?
:-)

Ok, here it goes.
After working with several proprietary o/r layers I finally got the 
chance to work with ODMG compliant OO databases (POET and Objectivity) 
in a project.
I was impressed how much time I safed without all the complicated and 
error prone database access stuff. I was able to implement a persistent 
XML DOM within 2 days!

Unfortunately our DBAs refused to support OO databases.

So I thought that it would be a good idea to use an O/R mapping layer 
that provides a complete OO (i.e. ODMG or JDO) view to the application 
developer but still uses an RDBMS in the backend to make the DBAs happy.

At that time (mid of 2000) I was not able to find a commercial or 
opensource tool that met our requirements. So I started to work on a 
very simple prototype that should be used to convince our management 
that such a beast was quite useful to have.
Unfortunately the whole project was stopped.

I then uploaded my prototype to sourceforge as I thought maybe this 
could still be useful to someone. (this prototype is still available at 
the OJB museum: 
http://sourceforge.net/project/showfiles.php?group_id=13647package_id=11528release_id=15024.
The next version already had the ODMG prototype: 
http://sourceforge.net/project/showfiles.php?group_id=13647package_id=11528release_id=15325).
I got encouraging responses and so we started the whole thing at sf.

After some time I was contacted by Jason van Zyl who invited me to 
present OJB to a meeting of the Torque group. They liked it and OJB was 
invited to join the Jakarta project.

The next big thing was the foundation of the db.apache.org subproject 
which was formed to coordinate all the database related activities at 
apache.

I hope that was short and sweet enough!

cu,
Thomas
Thanks,
   Brian
-
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: Problem with reading records having a PK with value 0 (not nu ll)

2004-01-08 Thread Alexandre Morin
I'm using a Long object to store the Id, so I thought 0 should be considered
different than NULL. (BrokerHelper.isNull() consider this as null, though).
In the mapping file, the field is declared with jdbc type BIGINT.
I'm normally starting my sequences with 1, but there are places where I use
the Id=0 to represent a default value (which kind of means NULL, I agree)
but then this makes it possible to have a real record at the end of the
reference which can be helpful. 

Thanks,
-Alex

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: jeudi 8 janvier 2004 11:02
To: OJB Users List
Subject: Re: Problem with reading records having a PK with value 0 (not
null)

Hi Alex,

did you use *primitive datatypes* for your PK fields?
There is a null-0 problem. When is a primitive field null? OJB assume 
it's null when the value is 0. Normally all sequence manager 
implementation start with value 1 to avoid these conflicts.

If possible use real objects for PK fields.

regards,
Armin

Alexandre Morin wrote:
 Hi,
 
  
 
 It looks like OJB cannot fetch correctly records which have a BigInt
primary
 key with value 0; at least in the following conditions;
 
  
 
 - I'm using RC5
 
 - Have a table (here Locations) with a primary key Id with a
auto-increment
 sequence
 
 - I'm using Oracle 9.2
 
 - The table has a 1-N collection using a proxy.
 
  
 
  
 
 For instance, I have the following mapping:
 
  
 
 class-descriptor class=Locations table=LOCATIONS
 
  
 
 field-descriptor name=id column=ID 
 
 jdbc-type=BIGINT primarykey=true 
 
 autoincrement=true 
 
 sequence-name=locations_id_seq/
 
  
 
 field-descriptor name=latitude column=LATITUDE
 jdbc-type=BIGINT/
 
  
 
 field-descriptor name=longitude column=LONGITUDE
 jdbc-type=BIGINT/
 
 ...
 
 collection-descriptor name=collElements 
 
 element-class-ref=Elements proxy=true
 
   inverse-foreignkey field-ref=locationid/
 
 /collection-descriptor
 
  
 
   /class-descriptor
 
  
 
  
 
 Now in the database, there is a location with Id=0.
 
 When I use OJB to fetch this record (with a criteria on Id=0), the
resulting
 instance is correct except for the Id field which has the next sequence
 value.
 
  
 
 Tracing the code, what happens is when the query is executed:
 
  
 
 -  RsIterator.getObjectFromResultSet reteive the simple fields
 correctly
 
 -  As there is a collection, retrieveCollections is called
 
 -  The query to retrieve the collection is built: Query fkQuery =
 getFKQuery(obj, cld, cds); 
 
 -  This retrieves the PK fields values (getFKQuery1toN ) which
 indirectly calls getValuesForObject 
 
 -  When the value for the Id is retrieved (getAutoIncrementValue),
 it is considered as Null (BrokerHelper.isNull) and thus the sequence is
 called.
 
  
 
 Can this be considered a bug?
 
 Are there any workarounds?
 
  
 
  
 
 Thanks,
 
  
 
 -Alex
 
  
 
 



-
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: Problem with reading records having a PK with value 0 (not null)

2004-01-08 Thread Danilo Tommasina
Hi Armin,

here a short example.

create TABLE FOO ( TAB_ID INTEGER PRIMARY KEY )
and put an entry into the table with ID = 0 (from SQL not from OJB)
/*/
repoistory.xml
class-descriptor class=org.apache.ojb.test.Foo table=FOO 

field-descriptor name=tabId column=TAB_ID jdbc-type=DECIMAL 
nullable=false primarykey=true autoincrement=true /

class-descriptor/

//
public class Foo {
public Integer tabId;

//Add getter and setter

}



//
some test code
(...)
Criteria c = new Criteria();
c.addEqualTo( tabId, new Integer( 0 ) );
Query q = new QueryByCriteria( Foo.class, c );
Foo myFoo = (Foo) pb.getObjectByQuery( q );

pb.beginTransaction();
pb.store( myFoo );
pb.commitTransaction();
(...)
and now you have two entries in your database (Integer PK with value 0 
was interpreded as null and a new clone has been inserted)

This is actually a minor issue, since it is not possible through OJB to 
add a DB entry with a PK = 0, in this case the error will never occur.
However if you are using data inserted by other applications it is 
possible to have entries with ID = 0 to work with.

sorry I didn't tested the code, I hope it works...

bye
Danilo

Hi Danilo,

Danilo Tommasina wrote:

Hi,

I reported the same issue some months ago...
The problem lies in the support for primitive data types, since a 
primitive type cannot be null, the value 0 is interpreted as null.
It seems that non primitive data types also react the same way (even 
if they shouldn't, so from my point of view it is a bug)


if so, I agree sounds like a bug. Can you post a test case to reproduce 
the problem or describe what to do with pseudo code?

Fetching an object with ID = 0 works, however OJB will handle the 0 
value as null and put the next sequence value into the fetched object 
on next store or when calling a 
PeristenceBroker.retrieveAllReferencies( Object obj )


For OJB 1.1 a complete refactoring of the primitive data types handling 
is scheduled.
Here you can post your proposals for the upcoming 1.1 version

http://nagoya.apache.org/wiki/apachewiki.cgi?OJBProjectPages/OJBOnePointOne



The workaround is to never use IDs = 0 and this is actually what I am 
doing ;)


or don't use primitive data types for PK fields in your pc objects (or 
do both ;-)).

regards,
Armin
bye
Danilo
Hi,

 

It looks like OJB cannot fetch correctly records which have a BigInt 
primary
key with value 0; at least in the following conditions;

 

- I'm using RC5

- Have a table (here Locations) with a primary key Id with a 
auto-increment
sequence

- I'm using Oracle 9.2

- The table has a 1-N collection using a proxy.

 

 

For instance, I have the following mapping:

 

class-descriptor class=Locations table=LOCATIONS

 

field-descriptor name=id column=ID
jdbc-type=BIGINT primarykey=true
autoincrement=true
sequence-name=locations_id_seq/
 

field-descriptor name=latitude column=LATITUDE
jdbc-type=BIGINT/
 

field-descriptor name=longitude column=LONGITUDE
jdbc-type=BIGINT/
...

collection-descriptor name=collElements
element-class-ref=Elements proxy=true
  inverse-foreignkey field-ref=locationid/

/collection-descriptor

 

  /class-descriptor

 

 

Now in the database, there is a location with Id=0.

When I use OJB to fetch this record (with a criteria on Id=0), the 
resulting
instance is correct except for the Id field which has the next sequence
value.

 

Tracing the code, what happens is when the query is executed:

 

-  RsIterator.getObjectFromResultSet reteive the simple fields
correctly
-  As there is a collection, retrieveCollections is called

-  The query to retrieve the collection is built: Query 
fkQuery =
getFKQuery(obj, cld, cds);
-  This retrieves the PK fields values (getFKQuery1toN ) which
indirectly calls getValuesForObject
-  When the value for the Id is retrieved 
(getAutoIncrementValue),
it is considered as Null (BrokerHelper.isNull) and thus the sequence is
called.

 

Can this be considered a bug?

Are there any workarounds?

 

 

Thanks,

 

-Alex

 




-
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]


closing connections

2004-01-08 Thread Daniel Perry
I'm having a problem trying to release database connections.
Here's what i understand of how it works

I assume the PB opens data connections when it's first used. A 
connectionfactoryfactory is created, and connections are opened by the 
connectionfactory.

Now, to shut down the database, i release all PBs from the PB pool:
PersistenceBrokerFactory.releaseAllInstances();

Now, to get at the connection factory i use: 

ConnectionFactoryFactory.getInstance().createConnectionFactory()

Although the method is called create - it doesnt create one if one has already been 
created.

From what i can make out of ConnectionFactoryPooledImpl, releaseAllResources() should 
release all connections.

So why does the following not release database connections?

ConnectionFactoryFactory.getInstance().createConnectionFactory().releaseAllResources();

Thanks,

Daniel.


RE: integrity constraint violation

2004-01-08 Thread Gelhar, Wallace Joseph
Hi Dirk,

Can you post the relevant DDL and repository?  Is the person-activity relation defined 
as a non-decomposed m-n relation?  I suspect you have a constraint set in the DDL that 
prevents the relation from being stored.  As far as the 0 is concerned, do you use a 
primitive int or an Integer object to store your PK?  If you use a primitive, a zero 
is the default value that OJB will interpret as null.

Good luck,

Wally Gelhar
  
-Original Message-
From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 4:54 AM
To: 'OJB Users List'
Subject: AW: integrity constraint violation 
Sensitivity: Personal


Hi there,

can anyone give me a hint about my problem (see below)? if I have the following two 
tables

*** *
* 
* Table PERSON  *
* Table ACTIVITY*
*-
* _0..1N_   * -
-   *
* personId INTEGER NOT NULL Identity Primary Key*
*  activityId INTEGER NOT NULL Identity Primary Key *
*   *
*  personId INTEGER (foreign key)   *

*...*

with a 0..1-to-many relation. both tables are empty. it should be possible to create 
an activity and store it without assigning a person, right?! However I get a violated 
constraint exception for table PEERSON, although I did not setup any value for 
personId as no row exists in table person. after traced the exception message I found 
out, that for the attribute person_id OJB generated a 0 value and tries to store it 
and I just read in another message that there is a 0-null problem for OJB. Am I facing 
exact this problem?

help appreciated!

thx,
Dirk


 

-Ursprüngliche Nachricht-
Von: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 7. Januar 2004 18:56
An: [EMAIL PROTECTED]
Betreff: integrity constraint violation 



Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with HSQLDB and 
have set up a table 'person' with personId as primary key and a second table 
'activity' with this attribute as foreign key (null allowed). the datatyp is integer 
and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it. however, 
when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.KeyConstraintViolatedException 
java.sql.SqlException: integrity constraint violation for table 'person'. What am I 
doing wrong?
 
thx,
Dirk
 


-
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]



`Single Proxy for a Whole Collection` problem

2004-01-08 Thread Andrei Ivanov

Hello,
I've created a mapping like this:

class-descriptor
class=com.ines.flanco.model.ProductTO
table=products

field-descriptor
name=id
column=id
jdbc-type=INTEGER
nullable=false
primarykey=true
autoincrement=true
sequence-name=products_id_seq
/
field-descriptor
name=name
column=name
jdbc-type=VARCHAR
nullable=false
/
collection-descriptor
name=symbols
element-class-ref=com.ines.flanco.model.SymbolTO
proxy=true
auto-update=true
auto-delete=true
indirection-table=products_symbols
fk-pointing-to-this-class column=product/
fk-pointing-to-element-class column=symbol/
/collection-descriptor
/class-descriptor

And created the objects:

public class ProductTO implements java.io.Serializable {

protected int id;
protected String name;
protected Vector symbols;

getters and setters...

public void setSymbols(Vector symbols){
this.symbols = new Vector(symbols);
}
public Vector getSymbols(){
return symbols;
}
}

public class SymbolTO implements java.io.Serializable {

protected int id;
protected String name;
protected String description;

getters and setters...
}

If I don't use the proxy feature for the collection everything is fine.

My problem is that I get an exception when I mark it as a proxy:

[PersistentField] ERROR: while set field:
object class[ com.ines.flanco.model.ProductTO
target field: symbols
target field type: class java.util.Vector
object value class: org.apache.ojb.broker.accesslayer.ListProxy
object value: [EMAIL PROTECTED]
null
java.lang.IllegalArgumentException
at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:519)
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown
 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
.

2004-01-08 16:46:59 StandardWrapperValve[action]: Servlet.service() for 
servlet action threw exception
org.apache.ojb.broker.metadata.MetadataException: Error setting 
field:symbols in object:com.ines.flanco.model.ProductTO
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doSet(Unknown
 
Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.set(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollection(Unknown 
Source)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollections(Unknown 
Source)



Can you please tell me what I did wrong ?

Thank you.

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



RE: `Single Proxy for a Whole Collection` problem

2004-01-08 Thread oliver . matz
Hello,

 public class ProductTO implements java.io.Serializable {
 
 protected int id;
 protected String name;
 protected Vector symbols;

'Vector' is not a good idea.  You should use an interface
type such as Collection or List for the type declaration ...

 getters and setters...

... and also for the parameter and return types.

 My problem is that I get an exception when I mark it as a proxy:
 
 [PersistentField] ERROR: while set field:
 object class[ com.ines.flanco.model.ProductTO
 target field: symbols
 target field type: class java.util.Vector
 object value class: org.apache.ojb.broker.accesslayer.ListProxy

This is a good error message, isn't it?
The proxy is of type ListProxy, which implements the List interface
but is not assignable to a field of type Vector.


HTH,
Olli
-- 
  Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax   +49 (0) 43 1-53 53-2 22
  email mailto:[EMAIL PROTECTED]
  web   www.ppi.de

Explore your printnet!

DRUPA 2004
Düsseldorf, Germany, 6 - 19 May 2004, Booth 6E62


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



AW: integrity constraint violation

2004-01-08 Thread Dirk Manske (Service Respond)
Hi Wally,

thanks for your response. Below you will find ddl and repository.
The relation is not defined as a non-decomposed m:n relation. And yes, I use
a primitive int to store the pk. Should I
give this special attention? For personId there is no reference-descriptor
defined as I have only read-access to this table
so OJB will never be forced to store data in it. that is why there is no
table TPPERSON in the repository. I am not sure if
this can work at all with OJB, I am just a newbie in this area. but, the
excpetion being thrown is an java.sql.SqlException and OJB passes it
through, so I begin thinking this has nothing to do with OJB. I am really
lost, hope you can help me.

Dirk



CREATE TABLE TPPERSON(
PERSON_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,
PERSON_VNAME CHAR(32),
PERSON_NNAME CHAR(32) ...);

CREATE TABLE TPACTIVITY (
ACTIVITY_ID INTEGER NOT NULL IDENTITY PRIMARY KEY,
ACTIVITY_NAME CHAR(32) NOT NULL,
ACT_DEFERRABLE CHAR(3) NOT NULL,
MAN_HOURS INTEGER NOT NULL,
MILESTONE CHAR(3) NOT NULL,
ACTIVITY_TYPE_ID INTEGER NOT NULL,
PRIORITY_ID INTEGER NOT NULL,
PERSON_ID INTEGER,
VENTURE_ID INTEGER NOT NULL,
STATUS_ID INTEGER NOT NULL,
MODULE_ASSIGNED_ID INTEGER NOT NULL,
ACTIVITY_OWNER_ID INTEGER NOT NULL,
CREATION_DATE DATE NOT NULL,
VERSION_NR INTEGER NOT NULL,
VALID_FROM_TIMEPT TIMESTAMP NOT NULL,
VALID_TO_TIMEPT TIMESTAMP NOT NULL,
TIMESTAMP TIMESTAMP NOT NULL,
USERID CHAR(8) NOT NULL,
PROGRAM CHAR(32) NOT NULL,
ACTIVITY_DESC VARCHAR(254));

ALTER TABLE TPACTIVITY ADD CONSTRAINT FK_PERSON FOREIGN KEY (PERSON_ID)
REFERENCES TPPERSON(PERSON_ID);

ALTER TABLE TPACTIVITY ADD CONSTRAINT FK_MODULE_ASSIGNED FOREIGN KEY
(MODULE_ASSIGNED_ID) REFERENCES TMODULE(MODULE_ASSIGNED_ID)

class-descriptor
class=de.premiere.plato.app.activity.entity.ActivityModel
table=TPACTIVITY 
field-descriptor id=1name=intActivityId
column=ACTIVITY_IDjdbc-type=INTEGER primarykey=true
autoincrement=true /
field-descriptor id=2name=strActivityName
column=ACTIVITY_NAME  jdbc-type=CHAR /
field-descriptor id=3name=strActivityDeferrable
column=ACT_DEFERRABLE jdbc-type=CHAR /
field-descriptor id=4
name=intActivityManHourscolumn=MAN_HOURS
jdbc-type=INTEGER /
field-descriptor id=5name=strActivityMilestone
column=MILESTONE  jdbc-type=CHAR /
field-descriptor id=6name=intActivityTypeId
column=ACTIVITY_TYPE_ID   jdbc-type=INTEGER /  
field-descriptor id=7name=intPriorityId
column=PRIORITY_IDjdbc-type=INTEGER /  
field-descriptor id=8name=intPersonId
column=PERSON_ID  jdbc-type=INTEGER /
field-descriptor id=9name=intVentureId
column=VENTURE_ID jdbc-type=INTEGER /
field-descriptor id=10   name=intStatusId
column=STATUS_ID  jdbc-type=INTEGER /  
field-descriptor id=11
name=intModuleAssignedIdcolumn=MODULE_ASSIGNED_ID   jdbc-type=INTEGER
/  
field-descriptor id=12   name=intActivityOwnerId
column=ACTIVITY_OWNER_ID  jdbc-type=INTEGER /  
field-descriptor id=13   name=creationDate
column=CREATION_DATE  jdbc-type=DATE /
field-descriptor id=14   name=versionNr
column=VERSION_NR jdbc-type=INTEGER /
field-descriptor id=15
name=validFromTimepointcolumn=VALID_FROM_TIMEPT
jdbc-type=TIMESTAMP /
field-descriptor id=16   name=validToTimepoint
column=VALID_TO_TIMEPTjdbc-type=TIMESTAMP /
field-descriptor id=17   name=timestamp
column=TIMESTAMP  jdbc-type=TIMESTAMP /
field-descriptor id=18   name=strUserId
column=USERID jdbc-type=CHAR /
field-descriptor id=19   name=strProgram
column=PROGRAMjdbc-type=CHAR / 
field-descriptor id=20   name=strActivityDescription
column=ACTIVITY_DESC  jdbc-type=VARCHAR /  
reference-descriptor name=moduleAssignedModel

class-ref=de.premiere.plato.app.module.entity.ModuleAssignedModel
refresh=true
auto-retrieve=true 
foreignkey field-id-ref=11 /
/reference-descriptor
/class-descriptor


 

-Ursprüngliche Nachricht-
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 8. Januar 2004 15:40
An: OJB Users List
Betreff: RE: integrity constraint violation 
Vertraulichkeit: Persönlich

Hi Dirk,

Can you post the relevant DDL and repository?  Is the person-activity
relation defined as a non-decomposed m-n relation?  I suspect you have a
constraint set in the DDL that prevents the relation from being stored.  As
far as the 0 is concerned, do you use a primitive int or an Integer object
to store your PK?  If you use a primitive, a zero is the default value that
OJB will interpret as null.

Good luck,

Wally Gelhar
  
-Original Message-
From: Dirk 

RE: `Single Proxy for a Whole Collection` problem

2004-01-08 Thread oliver . matz
Hello,

 -Original Message-
 From: Andrei Ivanov [mailto:[EMAIL PROTECTED]

 I see here 
 http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html 
 that Vector implements the List interface, and I used Vector because it's 

that means that you can assign a Vector to a field of type List,
but not vice versa.

 in the ojb documentation: 

 The association is implemented by the Vector attribute allArticlesInGroup

 on the ProductGroup class.


http://db.apache.org/ojb/tutorial3.html#Using%20a%20Single%20Proxy%20for%20a
%20Whole%20Collection

In that example, no proxies are used for that collection.
If I had written these classes, I would have used interface types
in the declarations and ArrayList for the instantiation.
There is a performance advantage of ArrayList against Vector,
because access to elements is synchronized in Vector.

To sum up: Vector is evil.

Olli

-- 
  Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone +49 (0) 43 1-53 53-422
  fax   +49 (0) 43 1-53 53-2 22
  email mailto:[EMAIL PROTECTED]
  web   www.ppi.de

Explore your printnet!

DRUPA 2004
Düsseldorf, Germany, 6 - 19 May 2004, Booth 6E62


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



Data Type Cast When Perform the Join

2004-01-08 Thread Xu Jie

Hello,

I have to do a simple one-to-one mapping with OJB. The key to perform the
join from parent object is different from the child key. For example, in
parent object the key is userID with type of CHAR, but the child object key
childUserID is a type of BIGINT. Will OJB do any data cast in this
situation?

Thanks.
 



---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED] 

Thank you

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



j2ee.jar

2004-01-08 Thread Daniel Perry
Not sure if i'm being rather inept, but i cant find the j2ee.jar file on suns site.
Do i have to download the entire J2EE SDK? or can i get this file on it's own?

Thanks,
Daniel.

AW: j2ee.jar

2004-01-08 Thread André Kofaldt
You have to download the J2EE SDK!

Cheers, André


-Ursprüngliche Nachricht-
Von: Daniel Perry [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 8. Januar 2004 16:42
An: OJB Users List
Betreff: j2ee.jar


Not sure if i'm being rather inept, but i cant find the j2ee.jar file on
suns site.
Do i have to download the entire J2EE SDK? or can i get this file on it's
own?

Thanks,
Daniel.


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



ojb query question

2004-01-08 Thread Jair da Silva Ferreira Júnior
Hi,
I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb tables)
in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
How can I run a query that returns objects from a different class than
the class to search from? For example:

class Person{
int id;
String name;

//rest of the class ommited
}

class House{
int id;
String name;

int ownerId;
Person owner; //reference to Person

//rest of the class ommited
}

The House class has a reference to the Person class.

I want to build a query like this:
  Criteria c=new Criteria();
  c.addEqualTo(name,home);
  QueryByCriteria query=QueryFactory.newQuery(House.class,c);

  I want the query to return objects of the Person class using the
reference from House (owner atribute).
  Something like:
  query.setSelectAttribute(owner,true); //the true parameter
is to return distinct objects
or
  broker.getCollectionByQuery(query,owner,true);

  I looked for a similar method in OJB api and docs and couldn't
find one. Is there such a similar method or is there anyway I can achieve
the same result?

I know that I can get House objects from the query and then get the
Person objects I need in a loop, but that would make performance suffer in
my scenario.
Please, notice that I don't have a collection of Houses in Person
because that would also make performace suffer in my scenario.

Any help would be appreciated.

Thanks,
Jair Jr



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



Re: AW: j2ee.jar

2004-01-08 Thread Brian McCallister
I find the sun one so annoying to download that I grab it from JBoss 
and rename it ;-)

-Brian

On Jan 8, 2004, at 10:46 AM, André Kofaldt wrote:

You have to download the J2EE SDK!

Cheers, André

-Ursprüngliche Nachricht-
Von: Daniel Perry [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 8. Januar 2004 16:42
An: OJB Users List
Betreff: j2ee.jar
Not sure if i'm being rather inept, but i cant find the j2ee.jar file 
on
suns site.
Do i have to download the entire J2EE SDK? or can i get this file on 
it's
own?

Thanks,
Daniel.
-
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: AW: j2ee.jar

2004-01-08 Thread Clay Mitchell
Are you talking about j2ee 1.3 or 1.4? because I've never been able to
find the 1.4 jar without the whole app server...

-Clay

 You have to download the J2EE SDK!

 Cheers, André


 -Ursprüngliche Nachricht-
 Von: Daniel Perry [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 8. Januar 2004 16:42
 An: OJB Users List
 Betreff: j2ee.jar


 Not sure if i'm being rather inept, but i cant find the j2ee.jar file on
 suns site.
 Do i have to download the entire J2EE SDK? or can i get this file on it's
 own?

 Thanks,
 Daniel.


 -
 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: AW: j2ee.jar

2004-01-08 Thread Daniel Perry
Not sure...
whichever i need to compile OJB
just installing the J2ee stuff... though i dont want their app server!
Daniel.

- Original Message - 
From: Clay Mitchell [EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 3:50 PM
Subject: Re: AW: j2ee.jar


 Are you talking about j2ee 1.3 or 1.4? because I've never been able to
 find the 1.4 jar without the whole app server...

 -Clay

  You have to download the J2EE SDK!
 
  Cheers, André
 
 
  -Ursprüngliche Nachricht-
  Von: Daniel Perry [mailto:[EMAIL PROTECTED]
  Gesendet: Donnerstag, 8. Januar 2004 16:42
  An: OJB Users List
  Betreff: j2ee.jar
 
 
  Not sure if i'm being rather inept, but i cant find the j2ee.jar file on
  suns site.
  Do i have to download the entire J2EE SDK? or can i get this file on
it's
  own?
 
  Thanks,
  Daniel.
 
 
  -
  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: ConnectionFactoryPooledImpl - releaseAllResources

2004-01-08 Thread Daniel Perry
AHHH going mad.
I think i know what's happeneing. I dont think there's a problem with OJB
afterall.

I'm storing objects with proxied collections in an HTTPSession.  Am i right
in thinking that these will have references that will cause the database to
maintain connections even if the connection pool is closed?

Thanks,
Daniel.

- Original Message - 
From: Daniel Perry [EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 5:20 PM
Subject: ConnectionFactoryPooledImpl - releaseAllResources


 The releaseAllResources method in ConnectionFactoryPooledImpl is not
 releaseing database connections.

 I've been trying to debug it, but dont understand how the objectpool
works,
 and am now stumped.

 This is causing big problems for my app as i have an embedded hsqldb which
 needs to be released so another app can connect to it.

 Thanks for any help,

 Daniel.


 -
 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: ConnectionFactoryPooledImpl - releaseAllResources

2004-01-08 Thread Armin Waibel
Hi Daniel,

I'm not sure what's the problem in your case, but I think it's OJB. The 
connection/pooling stuff needs some refactoring before 1.1 ;-)

In your previous mail you said

 Now, to get at the connection factory i use:

 ConnectionFactoryFactory.getInstance().createConnectionFactory()

 Although the method is called create - it doesnt create one if one 
has already been created.

From what i can make out of ConnectionFactoryPooledImpl, 
releaseAllResources() should release all connections.


this will not work, because this creates a new ConnectionFactory instance.

You can try to do the following workaround (maybe there is a typo, I 
don't check this):
((ConnectionManagerImpl)broker.serviceConnectionManager()).getUnderlyingConnectionFactory().releaseAllResources()

This should free all connections of the associated DB.

regards,
Armin
Daniel Perry wrote:

AHHH going mad.
I think i know what's happeneing. I dont think there's a problem with OJB
afterall.
I'm storing objects with proxied collections in an HTTPSession.  Am i right
in thinking that these will have references that will cause the database to
maintain connections even if the connection pool is closed?
Thanks,
Daniel.
- Original Message - 
From: Daniel Perry [EMAIL PROTECTED]
To: OJB Users List [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 5:20 PM
Subject: ConnectionFactoryPooledImpl - releaseAllResources



The releaseAllResources method in ConnectionFactoryPooledImpl is not
releaseing database connections.
I've been trying to debug it, but dont understand how the objectpool
works,

and am now stumped.

This is causing big problems for my app as i have an embedded hsqldb which
needs to be released so another app can connect to it.
Thanks for any help,

Daniel.

-
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: Fwd: Using a non-existent collection inside a query

2004-01-08 Thread Jakob Braeuchi


Edson Carlos Ericksson Richter wrote:

(sorry, was a momentary lapse of reason when I clicked the send button).

Hi!

I'm facing a problem: I've a nice piece of sofware that load modules at
runtime.
Mostly, each module has their own .xml file with necessary configuration.
So, there are no problem here.
But imagine that I've a customer_repository.xml, that references a quite
large table (let's say 100.000, to take easy to imagine). If each customer
has 1:n fone numbers, 1:n address, 1:documents, 1:n anything else, and so
on, I need to make use of the Proxies, or I'll crash server (or workstation)
memory (even with 512Mb). Ok, that's fine. But when I open my Swing UI,
every JTable, JList, JCombo and so on insists in materialize every 1:N
mapping in .XML file. So, I have a very large time when materializing
objects (to materialize one single person I take near 2 seconds... A user
clicking away in the machine think that this is a long time to wait for
a simple navigation in records!
hi edson,

why don't you use a CollectionProxy for each of those 1:n collections ?

jakob

So I started to think in a solution where the collection is used when
mounting the WHERE clauses, but not when loading/writing objects to
database. And I started with API to create on-the-fly collections.
All worked well, as I imagined (I can add the collection and play with
fine), but the first time I've attempted to write one customer object I get
that some method X was not found in object Y... And if I put the method X, I
get column Z not in table from my database. So, the OJB is trying to
persist the collection (even if I set the auto retrieve, auto update and
auto delete as false). Since I thinked in terms of virtual collection (that
can exists or not), and the queries and materialization are working fine, I
started to imagine the I need to make a patch to guarantee that the
collection will never be stored. Then, I've added a attribute virtual
that, when receives true, is ignored by storeCollections loop.
My question is: can this be added to core OJB distribution, or I'll always
need to patch my own versions of OJB?
The method was modified on PersistenceBrokerImpl is (just the
if(!true.equals(cds.getAttribute(virtual))) was added, and the
respective block start and end), and doesn't affect nobody else than who
wanna use these virtual collection way of work (I can send the code sample
where I'm using this, if you want):
private void storeCollections(Object obj, Vector vecCds) throws
PersistenceBrokerException
{
// get all members of obj that are collections and store all their elements
Iterator i = vecCds.iterator();
while (i.hasNext())
{
CollectionDescriptor cds = (CollectionDescriptor) i.next();
if(!true.equals(cds.getAttribute(virtual))) {
Object col = cds.getPersistentField().get(obj);
Collection currentMtoNKeys = null;
if (col == null)
{
if (cds.isMtoNRelation())
{
deleteMtoNImplementor(cds, obj);
}
}
else
{
// MBAIRD
// if the collection is a collectionproxy and it's not already loaded
// no need to store it.
if (col instanceof CollectionProxy  !((CollectionProxy) col).isLoaded())
{
continue;
}
if (cds.isMtoNRelation())
{
currentMtoNKeys = getMtoNImplementor(cds, obj);
// delete unused m:n implementors
deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);
}
Iterator colIterator;
if (col instanceof ManageableCollection)
{
colIterator = ((ManageableCollection) col).ojbIterator();
}
else if (col instanceof Collection)
{
colIterator = ((Collection) col).iterator();
}
else if (col.getClass().isArray())
{
colIterator = new ArrayIterator(col);
}
else
{
throw new OJBRuntimeException(
col.getClass()
+  can not be managed by OJB, use Array, Collection or ManageableCollection
instead !);
}
while (colIterator.hasNext())
{
Object otherObj = colIterator.next();
// for m:n mapped collections store association implementing entries
if (cds.isMtoNRelation())
{
// 1. Store depended upon object first to avoid FK violation
storeCollectionObject(cds, otherObj);
// 2. Store indirection record
// BRJ: this could cause integrity problems because
// obj may not be stored depending on auto-update
storeMtoNImplementor(cds, obj, otherObj, currentMtoNKeys);
}
// for 1:n mapped collection assert proper fk assignment
else
{
if (cds.getCascadeStore())
{
// BRJ: do not assign fk if not required
// to avoid materialization of proxy
assertFkAssignment(otherObj, obj, cds);
}
storeCollectionObject(cds, otherObj);
}
}
// invoke callback on collection
if (col instanceof ManageableCollection)
{
((ManageableCollection) col).afterStore(this);
}
}
}
}
}




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 20/12/2003


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


How JDO knows about my DB ?

2004-01-08 Thread Hubert Behaghel
Hi,

I'm trying to get a simple application running with the jdo-api.

I went through the .java generation, the .jdo and the repository.xml
generation...

Now, I want to enhance my persistent .class as described in the .jdo.
But the process fails with a Timeout connection. In fact I have never
explained to the jdori how to get in touch with my dbms (MySQL).

Can you help  me ? (of course you can ;)

--
Hubert

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



ERROR: Invalid UNICODE character sequence found (0xc000)

2004-01-08 Thread Antonio Gallardo
Hi:

I am getting this error while quering a simple table in a PostgreSQL
database.  Interesting enough the error does not happen when we access the
database using other JDBC application.

The database was coded using:

createdb -E UNICODE myDBname

If I sent in the following code the variable filtro with z or Z it
throws an exception.

The problem occurs at this line:

Iterator qIter = broker.getIteratorByQuery(query);

The Java code is:

public void getList(Auth_userList bean, String filtro) throws Exception {
  PersistenceBroker broker = null;

  try {
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
// Define criterio
Criteria criterio = new Criteria();
if (filtro.length()  0)
  criterio.addLike(FILTRO, filtro + *);
criterio.addNotEqualTo(FILTRO, admin);
criterio.addOrderBy(FILTRO, true);

Query query = new QueryByCriteria(Auth_user.class, criterio);
Iterator qIter = broker.getIteratorByQuery(query);

while (qIter.hasNext()) {
  Auth_user temp = new Auth_user();
  PropertyUtils.copyProperties((Object)temp, (Object)qIter.next());
  bean.add(temp);
}
  } catch (Exception e) {
throw e;
  } finally {
if (broker != null  !broker.isClosed()) {
  broker.close();
}
  }
}

Here is the full exception:

Note: The same apply for the drivers:

pg73jdbc.jar
pg74jdbc.jar
pg74.1jdbc.jar

Please explain.

Best Regards,

Antonio Gallardo

at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source)
at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(Unknown
Source)
at test.miclassAuth_userHandler.getList(Auth_userHandler.java:81)

..

Caused by: java.sql.SQLException: ERROR:  Invalid UNICODE character
sequence found (0xc000)

at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)



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