IllegarlArgumentException Error

2004-02-03 Thread ANDRES FELIPE RINCON ZAPATA
You are right Andy, but I had probed every option with similar errors.

For instance when I selected PersistentFieldDirectAccessImpl this was
the console output.

[DEFAULT] ERROR: Error getting field:idAtributo in object:com.ecip.ojb.AtributoImpl
org.apache.ojb.broker.metadata.MetadataException: Error getting field:idAtributo in 
object:com.ecip.ojb.AtributoImpl
at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doGet(Unknown
 Source)
at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown Source)
at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)



This is the class, it have private fields and public getters and setters.
I thought that PersistentFieldIntrospectorImpl option was right.

package com.ecip.ojb;
public class AtributoImpl implements Atributo, java.io.Serializable {
  
  private Integer idAtributo;
  private String atributo;
  private String descripcion;

  public Integer getIdAtributo() {
return idAtributo;
  }

  public String getAtributo() {
return atributo;
  }

  public String getDescripcion() {
   return descripcion;
  }

  public void setIdAtributo(Integer id) {
this.idAtributo = id;
  }

  public void setAtributo(String atrib) {
this.atributo = atrib;
  }

  public void setDescripcion(String descrip) {
this.descripcion = descrip;
  }
}

Is this class OK?
What else should I check in the ojb properties file?


Thanks Andy.



From: Andy Malakov <[EMAIL PROTECTED]>
Subject: IllegarlArgumentException Error
Sent: Tue, 3 Feb 2004 18:08:56 -0500
Subject: IllegarlArgumentException Error


Check your OJB.properties (PersistentFieldClass). You seems to be using 
PersistentFieldIntrospectorImpl which require
JavaBeans-style getters and setters.





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



Re: FW: How to set null for a column for which the corresponding java type is long

2004-02-03 Thread ZZZ Liu
Thanks a lot for all of your answers. I just realized
that OJB can convert from JDBC types to Number
(Integer, Long, BigInteger,BigDecimal) automatically.
For example, JDBC type BIGINT can be converted to
either primitive long or Object Long without any
FieldConversion. In this case, I can just use Long
instead of long to solve the problem. 

Just wondering anybody can update the document
http://db.apache.org/ojb/jdbc-types.html to make that
explicit?

Thanks,
Zhe

> 
> 
> -Original Message-
> From: Martin Kalén [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 28, 2004 1:04 AM
> To: OJB Users List
> Subject: Re: How to set null for a column for which
> the corresponding
> java type is long
> 
> 
> Danilo Tommasina wrote:
> 
> >> I have a data base column. The data type is
> number
> >> (10). It is nullable. The JDBC type defined in
> >> repository is BIGINT and the corresponding java
> type
> >> is long (default). Can anybody tell me how to
> save a
> >> record so that the value of that column is null
> >> instead of zero?
> >
> > Do not use a primitive data type in your
> persistent class, use instead a
> >  subtype of Number. (Integer, Long, BigInteger,
> BigDecimal,... )
> 
> Or; if you don't have control over the bean or want
> to keep long, use a
> field conversion class that converts long values of
> 0 as NULL.
> 
> There are quite a few pre-packaged field conversion
> classes that come
> with OJB, they can be found in the package:
> org.apache.ojb.broker.accesslayer.conversions
> 
> The Int2IntegerFieldConversion class can be used as
> a template for how
> to write a field conversion for a long with
> 0-inserts as NULL.
> 
> See
>
http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/src/java/org/apache/ojb/
>
broker/accesslayer/conversions/Int2IntegerFieldConversion.java?content-type=
> text%2Fplain&rev=1.3
> 
> 
> To use field conversions, specify them in your
> repository. Eg:
> 
> 
>jdbc-type="{x}"
>
>
conversion="com.mycompany.PrimitiveLong2LongFieldConversion"/>
> 
> 
> HTH,
>   Martin
> 
> --
> Martin Kalén
> Curalia AB  Web:  http://www.curalia.se
> Orrspelsvägen 2BMail: [EMAIL PROTECTED]
> SE-182 79  StocksundTel:  +46-8-410 064 40
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



Re: FW: setStartAtIndex/setEndAtIndex for a very large result set

2004-02-03 Thread ZZZ Liu
After more investigation by looking into OJB code, I
found that the out of memory problem occurs in
org.apache.ojb.broker.accesslayer.RsIterator.size()
method. In that method, there are two ways to get
size:
1) count
2) .last .getRow

I found that 2) will give me out of memory error.I
tried that with pure JDBC and also got out of memory
error. However, if I force to use 1), it works fine. I
am using Oracle 9i. I am worndering whether there is
any way to solve this problem. Currently I have to set
jdbc-level="1.0" instead of "2.0" to force 1) is used.

Thanks,
Zhe
 

> 
> -Original Message-
> From: ZZZ Liu [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 02, 2004 9:01 PM
> To: [EMAIL PROTECTED]
> Subject: setStartAtIndex/setEndAtIndex for a very
> large result set
> 
> 
> Hi, All
> 
> I am trying to do a simple query against a very
> large
> table with over 200,000 records. I use
> QueryByCriteria
> without any criteria, but settiing
> setStartAtIndex(1)
> and setEndAtIndex(2). Then I use getIteratorByQuery
> to
> get the result. However, I got OutOfMemory error.
> 
> I tried the same thing on a relatively small table
> (about 100 records) and it works fine.
> 
> Could anybody shed some light on this?
> 
> Thanks,
> Zhe
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool.
> Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



IllegalArgumentException Error

2004-02-03 Thread ANDRES FELIPE RINCON ZAPATA
I am a newbie in OJB. I was working with EJB entity beans and Jboss or Websphere in 
other projects.

Last two weeks I was creating the persistent java classes and the repository files; I 
configured
the conection for MSSql Server database; then I ran a simple unit test expectig a 
single row but it always returns an error.

I was searching in the mail archive for similar questions but I didn´t find anything.

All I know is that the connection is Ok and the repository and properties files are in 
the classpath.

Any help will be appreciated.
Thanks in advance.

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [idAtributo]

[DEFAULT] ERROR: Property Type [java.lang.Integer]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getIdAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getIdAtributo 
in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

... 17 more

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [atributo]

[DEFAULT] ERROR: Property Type [java.lang.String]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getAtributo in object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getAtributo in 
object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)


IllegalArgumentException Error

2004-02-03 Thread ANDRES FELIPE RINCON ZAPATA
I am a newbie in OJB. I was working with EJB entity beans and Jboss or Websphere in 
past projects.

I created the persistent java classes and the repository files; I configured
the conection for MSSql Server database; then I ran a simple unit test that expected a 
single row, but it returns an error.

I was searching the mail archive for similar questions but I didn´t find anything.

All I know is that the connection is Ok and the repository and properties files are in 
the classpath.

Any help will be appreciated.
Thanks in advance.

This is the entry for the table I want to read:


  
  
  



This is the error I am getting:

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [idAtributo]

[DEFAULT] ERROR: Property Type [java.lang.Integer]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getIdAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getIdAtributo 
in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

... 17 more

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [atributo]

[DEFAULT] ERROR: Property Type [java.lang.String]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getAtributo in object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getAtributo in 
object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso

Re: [OT] MSSQL jdbc driver

2004-02-03 Thread LAURENT Stephane
try JSQLConnect

http://www.jnetdirect.com

regards.

- Original Message - 
From: "Leandro Rodrigo Saad Cruz" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, December 08, 2003 5:19 PM
Subject: [OT] MSSQL jdbc driver


> Hi all...
> Do you know where I can find the MSSQL 7/2000 jdbc driver 
> that implements Statement.getMoreResults() ?
> 
> 
> -- 
> Leandro Rodrigo Saad Cruz
> IT - Inter Business Tecnologia e Servicos (IB)
> http://www.ibnetwork.com.br
> http://db.apache.org/ojb
> http://xingu.sourceforge.net
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.576 / Virus Database: 365 - Release Date: 31/01/2004

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



IllegalArgumentException Error

2004-02-03 Thread Andres Felipe Rincon Zapata
I am an OJB newbie. I was working with EJB entity beans on Jboss and 
Websphere in my last projects.

I am working with ojb rc5.

This is my situation:

I created the persistent java classes and the repository files, I configured
the conection for MSSql Server database; then I ran a simple unit test that 
expected a single AtributoImpl object, but it returned an error.

I was searching the mail archive for similar questions but I didn´t find 
anything.

All I know is that the connection is Ok and the repository and properties 
files are in the classpath.

Any help will be appreciated.
Thanks in advance.
This is the repository_user.xml entry for the table I wanted to read:


 
 
 


This is the error I am getting:

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [idAtributo]

[DEFAULT] ERROR: Property Type [java.lang.Integer]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getIdAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking 
method:getIdAtributo in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown 
Source)

at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at 
com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at 
jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of 
declaring class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

... 17 more

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [atributo]

[DEFAULT] ERROR: Property Type [java.lang.String]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking 
method:getAtributo in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown 
Source)

at 
org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at 
com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at 
jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of 
declaring class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethod

Criteria with select with no where clause?

2004-02-03 Thread Robert S. Sfeir
Can't seem to find a method which would allow me to add a criteria to 
return all records in a table.  select * from table without where 
clause... what's the trick?

R

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


RE: OJB auto-generated Id as Double?

2004-02-03 Thread Phil Armour
Armin,

Thanks for your help.
Changing of column type for MAX_KEY in repository_internal.xml caused OJB to accept 
larger IDs as you said.

thanks!
-phil

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 7:18 PM
To: OJB Users List
Subject: Re: OJB auto-generated Id as Double?


Hi Phil,

Phil Armour wrote:

> All,
> 
> I am having issues with generating id's of type double.

hope I understand your question. You want to use a PK/id field of java 
type double - right?

> The sql below that should return the max_key from the OJB_HL_SEQ table
> returns the value: 11334000 which is larger than an Integer can be.
> Thus we use a Double for the id's.

Why not using a Long?

> However, the OJB sequence seems to
> assume the field MAX_KEY is an integer, and therefore throws a Numeric
> Overflow SQLException as seen in the traces below.  Is this a problem
> for anyone else and has a fix been discussed?

I think it's a bug in repository_internal.xml. We declare MAX_KEY as 
Integer, but it should be BIGINT.
Does changing of column type for MAX_KEY solve your problem?

regards,
Armin

> 
> In the logs below i found it interesting that that ojb seems to be looking for a 
> Long:
>   at 
> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(SequenceManagerHighLowImpl.java:191)
> but the Oracle call seems to be looking for an Int:
>   at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1551)
> 
> 
> [Full Exception Trace]:
> 
> 1075770103075|0|1|statement|SELECT 
> A0.MAX_KEY,A0.TABLENAME,A0.GRAB_SIZE,A0.VERSION,A0.FIELDNAME FROM
>  OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE  ? ) AND A0.FIELDNAME LIKE  ? |SELECT 
> A0.MAX_KEY,A0.TABLENAM
> E,A0.GRAB_SIZE,A0.VERSION,A0.FIELDNAME FROM OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE  
> 'SEQ_TRK_CASE' )
>  AND A0.FIELDNAME LIKE  'ID'
> java.sql.SQLException: Numeric Overflow
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
> at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java:3677)
> at 
> oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:332)
> at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1551)
> at com.p6spy.engine.spy.P6ResultSet.getInt(P6ResultSet.java:261)
> at 
> org.apache.ojb.broker.util.SqlTypeHelper.getObjectFromColumn(SqlTypeHelper.java:573)
> at 
> org.apache.ojb.broker.util.SqlTypeHelper.getObjectFromColumn(SqlTypeHelper.java:328)
> at 
> org.apache.ojb.broker.util.SqlHelper.getObjectFromColumn(SqlHelper.java:169)
> 
> ...
> 
> rethrown as org.apache.ojb.broker.PersistenceBrokerException: Error reading class 
> type: org.apache.ojb.broker.util.sequence.HighLowSequence from result set: Numeric 
> Overflow
> at 
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(RowReaderDefaultImpl.java:171)
> at 
> org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:426)
> at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:263)
> at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1403)
> at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1563)
> at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1599)
> at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1588)
> at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1856)
> at 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:291)
> at 
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:291)
> at 
> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(SequenceManagerHighLowImpl.java:251)
> at 
> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(SequenceManagerHighLowImpl.java:191)
> at 
> org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(AbstractSequenceManager.java:125)
> at 
> org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelper.java:303)
> at 
> org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(BrokerHelper.java:349)
> at 
> org.apache.ojb.broker.util.BrokerHelper.getKeyValues(BrokerHelper.java:215)
> at org.apache.ojb.broker.Identity.init(Identity.java:165)
> at org.apache.ojb.broker.Identity.(Identity.java:129)
> 
> ...
> 
> 1075770103125|0|1|rollback||
>

Re: OJB auto-generated Id as Double?

2004-02-03 Thread Armin Waibel
Hi Phil,

Phil Armour wrote:

All,

I am having issues with generating id's of type double.
hope I understand your question. You want to use a PK/id field of java 
type double - right?

The sql below that should return the max_key from the OJB_HL_SEQ table
returns the value: 11334000 which is larger than an Integer can be.
Thus we use a Double for the id's.
Why not using a Long?

However, the OJB sequence seems to
assume the field MAX_KEY is an integer, and therefore throws a Numeric
Overflow SQLException as seen in the traces below.  Is this a problem
for anyone else and has a fix been discussed?
I think it's a bug in repository_internal.xml. We declare MAX_KEY as 
Integer, but it should be BIGINT.
Does changing of column type for MAX_KEY solve your problem?

regards,
Armin
In the logs below i found it interesting that that ojb seems to be looking for a 
Long:
at 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(SequenceManagerHighLowImpl.java:191)
but the Oracle call seems to be looking for an Int:
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1551)
[Full Exception Trace]:

1075770103075|0|1|statement|SELECT A0.MAX_KEY,A0.TABLENAME,A0.GRAB_SIZE,A0.VERSION,A0.FIELDNAME FROM
 OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE  ? ) AND A0.FIELDNAME LIKE  ? |SELECT A0.MAX_KEY,A0.TABLENAM
E,A0.GRAB_SIZE,A0.VERSION,A0.FIELDNAME FROM OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE  'SEQ_TRK_CASE' )
 AND A0.FIELDNAME LIKE  'ID'
java.sql.SQLException: Numeric Overflow
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java:3677)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:332)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1551)
at com.p6spy.engine.spy.P6ResultSet.getInt(P6ResultSet.java:261)
at org.apache.ojb.broker.util.SqlTypeHelper.getObjectFromColumn(SqlTypeHelper.java:573)
at org.apache.ojb.broker.util.SqlTypeHelper.getObjectFromColumn(SqlTypeHelper.java:328)
at org.apache.ojb.broker.util.SqlHelper.getObjectFromColumn(SqlHelper.java:169)

...

rethrown as org.apache.ojb.broker.PersistenceBrokerException: Error reading class 
type: org.apache.ojb.broker.util.sequence.HighLowSequence from result set: Numeric 
Overflow
at 
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(RowReaderDefaultImpl.java:171)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:426)
at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:263)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1403)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1563)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1599)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1588)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1856)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:291)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:291)
at 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(SequenceManagerHighLowImpl.java:251)
at 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(SequenceManagerHighLowImpl.java:191)
at 
org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(AbstractSequenceManager.java:125)
at 
org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelper.java:303)
at 
org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(BrokerHelper.java:349)
at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(BrokerHelper.java:215)
at org.apache.ojb.broker.Identity.init(Identity.java:165)
at org.apache.ojb.broker.Identity.(Identity.java:129)
...

1075770103125|0|1|rollback||
1075770103125|0|0|rollback||
ERROR 2004-02-02 20:01:43,125 [EMAIL 
PROTECTED]:org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not 
init Identity for given object beans.CaseBean: Could not obtain next object: Error 
reading class type: org.apache.ojb.broker.util.sequence.HighLowSequence from result 
set: Numeric Overflow
Regards,
Phil Armour


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

Re: IllegarlArgumentException Error

2004-02-03 Thread Andy Malakov
Check your OJB.properties (PersistentFieldClass). You seems to be using 
PersistentFieldIntrospectorImpl which require
JavaBeans-style getters and setters.

#
# Meta data / mapping settings
#
# The PersistentFieldClass property defines the implementation class
# for PersistentField attributes used in the OJB MetaData layer.
# By default the best performing attribute/refection based implementation
# is selected (PersistentFieldDirectAccessImpl).
#
# - PersistentFieldDirectAccessImpl
#   is a high-speed version of the access strategies.
#   It does not cooperate with an AccessController,
#   but accesses the fields directly. Persistent
#   attributes don't need getters and setters
#   and don't have to be declared public or protected
# - PersistentFieldPrivilegedImpl
#   Same as above, but does cooperate with AccessController and do not
#   suppress the java language access check.
# - PersistentFieldIntrospectorImpl
#   uses JavaBeans compliant calls only to access persistent attributes.
#   No Reflection is needed. But for each attribute xxx there must be
#   public getXxx() and setXxx() methods.
# - PersistentFieldDynaBeanAccessImpl
#   implementation used to access a property from a
#   org.apache.commons.beanutils.DynaBean.

- Original Message - 
From: "ANDRES FELIPE RINCON ZAPATA" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 03, 2004 4:11 PM
Subject: IllegarlArgumentException Error


I am a newbie in OJB. I was working with EJB entity beans and Jboss or Websphere in 
other projects.

Last two weeks I was creating the persistent java classes and the repository files; I 
configured
the conection for MSSql Server database; then I ran a simple unit test expectig a 
single row but it always returns an error.

I was searching in the mail archive for similar questions but I didn´t find anything.

All I know is that the connection is Ok and the repository and properties files are in 
the classpath.

Any help will be appreciated.
Thanks in advance.

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [idAtributo]

[DEFAULT] ERROR: Property Type [java.lang.Integer]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getIdAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getIdAtributo 
in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

... 17 more

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [atributo]

[DEFAULT] ERROR: Property Type [java.lang.String]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getAtributo in object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getAtributo in 
object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.met

Re: ObjectCacheOSCacheImpl without clustering

2004-02-03 Thread Jason McKerr
You use the same configuration as a single as in the Clustering
documentation, but just comment out the two lines:

cache.event.listeners=com.opensymphony.oscache.plugins.
clustersupport.JavaGroupsBroadcastingListener

AND

cache.cluster.multicast.ip=231.12.21.132


This will create OSCache in single environment without multicast
distribution. 

Jason

On Tue, 2004-02-03 at 14:15, Jair da Silva Ferreira Júnior wrote:
> 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).
> I've had some problems using the OJB default cache implementation
> (ObjectCacheDefaultImpl ) in RC5, so I would like to change the cache
> implementation to ObjectCacheOSCacheImpl and use oscache. At
> http://db.apache.org/ojb/howto-work-with-clustering.html I found information
> about using oscache in a clustered environment, however I want to use
> oscache in an environment without clustering. Please, can someone tell me
> how to do it?
> 
> Thanks,
> Jair Jr
> 
> 
> 
> -
> 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]



ObjectCacheOSCacheImpl without clustering

2004-02-03 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).
I've had some problems using the OJB default cache implementation
(ObjectCacheDefaultImpl ) in RC5, so I would like to change the cache
implementation to ObjectCacheOSCacheImpl and use oscache. At
http://db.apache.org/ojb/howto-work-with-clustering.html I found information
about using oscache in a clustered environment, however I want to use
oscache in an environment without clustering. Please, can someone tell me
how to do it?

Thanks,
Jair Jr



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



IllegarlArgumentException Error

2004-02-03 Thread ANDRES FELIPE RINCON ZAPATA
I am a newbie in OJB. I was working with EJB entity beans and Jboss or Websphere in 
other projects.

Last two weeks I was creating the persistent java classes and the repository files; I 
configured
the conection for MSSql Server database; then I ran a simple unit test expectig a 
single row but it always returns an error.

I was searching in the mail archive for similar questions but I didn´t find anything.

All I know is that the connection is Ok and the repository and properties files are in 
the classpath.

Any help will be appreciated.
Thanks in advance.

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [idAtributo]

[DEFAULT] ERROR: Property Type [java.lang.Integer]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getIdAtributo in 
object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getIdAtributo 
in object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

... 17 more

[DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], 
java.lang.IllegalArgumentException

[DEFAULT] ERROR: Declaring class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: Property Name [atributo]

[DEFAULT] ERROR: Property Type [java.lang.String]

[DEFAULT] ERROR: anObject was class [com.ecip.ojb.AtributoImpl]

[DEFAULT] ERROR: aValue was null

[DEFAULT] ERROR: Error invoking method:getAtributo in object:com.ecip.ojb.AtributoImpl

org.apache.ojb.broker.metadata.MetadataException: Error invoking method:getAtributo in 
object:com.ecip.ojb.AtributoImpl

at 
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl.doGet(Unknown
 Source)

at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown 
Source)

at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source)

at org.apache.ojb.broker.query.QueryByCriteria.(Unknown Source)

at com.ecip.example.OjbExample.readAtributoId(OjbExample.java:40)

at com.ecip.ojb.AtributoImplTest.testReadAtributoId1(AtributoImplTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at 
com.parasoft.eclipse.checker.java.unit.internal.core.test.RemoteTestRunner$1.runProtected(RemoteTestRunner.java:308)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at jtest.IndependentTestSuite$TestRunnerThread.run(IndependentTestSuite.java:249)

Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring 
class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)


RE: Stored Procedure / returning primary key

2004-02-03 Thread Christoph Bohl
This is the class-descriptor:


  
  
  
  
  
  
  
  
  
  
  
  













  


Thank you very much for your help!

Regards,
Chris

On Tue, 2004-02-03 at 13:16, Ron Gallagher wrote:
> Chris --
> 
> Please provide the class descriptor that contains this insert-procedure
> element.
> 
> Ron.
> 
> -Original Message-
> From: Christoph Bohl [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 02, 2004 1:52 PM
> To: [EMAIL PROTECTED]
> Subject: Stored Procedure / returning primary key
> 
> 
> Gurus,
> 
> I try to use a stored procedure to insert a table. This works perfectly. The
> stored procedure does correctly return the values that get inserted into the
> database.
> 
> Unfortunately, the object I am inserting does not change after the insert
> (toString() before and after). Can you please point out what I am doing
> wrong?
> Any help is greatly appreciated!
> 
> The repository_user.xml:
>   
>   
>   
>   
>   
>return="true"/>
>   
>   
>   
>   
>   
>   
>   
>   
> 
> The Java code tested (Persistence Broker API):
>   PersistenceBroker broker = null;
>try
>{
>broker =
> PersistenceBrokerFactory.defaultPersistenceBroker();
>broker.beginTransaction();
>broker.store(ztb);
>   broker.commitTransaction();
>}
>finally
>{
>if (broker != null) broker.close();
>}
> 
> ODMG API:
> //Implementation odmg = OJB.getInstance();
> //   Database db = odmg.newDatabase();
> //   try {
> //
> // db.open("TABI",
> Database.OPEN_READ_WRITE);
> //   } catch (Exception e) {
> //  System.out.println(e.toString());
> //   }
> //
> //TransactionExt tx = (TransactionExt) odmg.newTransaction();
> //System.out.println("vor insertf: " + ztb.toString());
> //
> //tx.begin();
> //tx.markDirty(ztb);
> //tx.commit();
> 
> Thank you very much!!
> 
> Cheers,
> Chris
> --
> "When you were born, you were crying and everyone around you was smiling.
> Live
> your life so that when you die, youre the one who is smiling and everyone
> around you is crying."
> 
> -
> 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: oracle and dates

2004-02-03 Thread mike jackson
I thought it did that automagically.  I guess I was wrong.  I'll go look at
that later today.

--mikej
-=--
mike jackson
[EMAIL PROTECTED]



> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 03, 2004 10:25 AM
> To: OJB Users List
> Subject: Re: oracle and dates
> 
> Hi Mike,
> 
> mike jackson wrote:
> 
> > I found my problem.  In line 287 of StatementManager there's a
> setObject(
> > Statement, value ) call.  It was getting a java.util.Date that hadn't
> been
> > converted to a java.sql.Date.  I added a check to see if the value was
> an
> > instanceof java.util.Date and to convert it to a java.sql.Date if it is.
> >
> this sounds like a field conversion problem, did you see
> 
> http://db.apache.org/ojb/jdbc-types.html
> 
> Describe how to use OJB 'FieldConversion' feature. There is a
> JavaDate2SqlDateFieldConversion class. Assume this will solve your
problem.
> 
> regards,
> Armin
> 
> 
> > --mikej
> > -=--
> > mike jackson
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> >>-Original Message-
> >>From: mike jackson [mailto:[EMAIL PROTECTED]
> >>Sent: Tuesday, February 03, 2004 8:37 AM
> >>To: 'OJB Users List'
> >>Subject: oracle and dates
> >>
> >>Datebase:   Oracle 8.1.7.4 or Oracle 9.2.0.4
> >>OJB Version:1.0rc5
> >>
> >>I'm having problems trying to do a search something like this:
> >>
> >>select * from foobar where date1 >= sysdate and date1 <= sysdate +1
> >>
> >>I've tried using the greaterThan and lessThan methods on criteria but I
> >>get
> >>an "invalid column error" from Oracle.  I thought that perhaps the
> >>parameters weren't getting bound to the PreparedStatement properly, but
> I
> >>think I've been able to rule that out.  It appears that it's failing in
> >>the
> >>setObject method of the Oracle driver.  I've tried to modify the
> >>setObjectForStatement but for some reason it's still using the
setObject.
> >>
> >>I then looked at the list archives and found something about using
> addSql,
> >>so I tried that.  That gave me StringOutOfBounds(-2) exceptions, with
> the
> >>criteria display showing that the I added looked to be added twice with
> a
> >>"null" at the end of the string (looks like this "null").  So
> >>I've
> >>been looking at the source for the addSql method which seems to create a
> >>SqlCriteria, all of which looks ok to me.  My guess is that the SQL
> >>generator is getting confused or something.
> >>
> >>I then tried setting up the criteria for the date ranges as separate
> >>criteria.  I added the second criteria to the first as an
addAndCriteria,
> >>but instead of having just one of the "null"'s I ended up with
> >>two
> >>of them.
> >>
> >>Anyway what I'm looking for is someone who can give me a clue of another
> >>way
> >>to make this work.  Or suggest somewhere in the code that I haven't
> looked
> >>at yet to fix.  I'll happily upload the repository.xml and the code that
> >>calls OJB if need be.
> >>
> >>--mikej
> >>-=--
> >>mike jackson
> >>[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]
> >
> >
> >
> 
> -
> 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: oracle and dates

2004-02-03 Thread Armin Waibel
Hi Mike,

mike jackson wrote:

I found my problem.  In line 287 of StatementManager there's a setObject(
Statement, value ) call.  It was getting a java.util.Date that hadn't been
converted to a java.sql.Date.  I added a check to see if the value was an
instanceof java.util.Date and to convert it to a java.sql.Date if it is.  

this sounds like a field conversion problem, did you see

http://db.apache.org/ojb/jdbc-types.html

Describe how to use OJB 'FieldConversion' feature. There is a 
JavaDate2SqlDateFieldConversion class. Assume this will solve your problem.

regards,
Armin

--mikej
-=--
mike jackson
[EMAIL PROTECTED]



-Original Message-
From: mike jackson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 03, 2004 8:37 AM
To: 'OJB Users List'
Subject: oracle and dates
Datebase:   Oracle 8.1.7.4 or Oracle 9.2.0.4
OJB Version:1.0rc5
I'm having problems trying to do a search something like this:

	select * from foobar where date1 >= sysdate and date1 <= sysdate +1

I've tried using the greaterThan and lessThan methods on criteria but I
get
an "invalid column error" from Oracle.  I thought that perhaps the
parameters weren't getting bound to the PreparedStatement properly, but I
think I've been able to rule that out.  It appears that it's failing in
the
setObject method of the Oracle driver.  I've tried to modify the
setObjectForStatement but for some reason it's still using the setObject.
I then looked at the list archives and found something about using addSql,
so I tried that.  That gave me StringOutOfBounds(-2) exceptions, with the
criteria display showing that the I added looked to be added twice with a
"null" at the end of the string (looks like this "null").  So
I've
been looking at the source for the addSql method which seems to create a
SqlCriteria, all of which looks ok to me.  My guess is that the SQL
generator is getting confused or something.
I then tried setting up the criteria for the date ranges as separate
criteria.  I added the second criteria to the first as an addAndCriteria,
but instead of having just one of the "null"'s I ended up with
two
of them.
Anyway what I'm looking for is someone who can give me a clue of another
way
to make this work.  Or suggest somewhere in the code that I haven't looked
at yet to fix.  I'll happily upload the repository.xml and the code that
calls OJB if need be.
--mikej
-=--
mike jackson
[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]


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


Re: oracle and dates

2004-02-03 Thread Andy Malakov
Hello Mike,

I do a  TIMESTAMP comparisons - works fine for me.

Check that value types that you use in query Criteria match with JDBC types of your 
columns
(http://db.apache.org/ojb/jdbc-types.html). And what is exact exception that you are 
getting?

All the Best,
Andy


- Original Message - 
From: "mike jackson" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Tuesday, February 03, 2004 11:36 AM
Subject: oracle and dates


Datebase:  Oracle 8.1.7.4 or Oracle 9.2.0.4
OJB Version: 1.0rc5

I'm having problems trying to do a search something like this:

select * from foobar where date1 >= sysdate and date1 <= sysdate +1

I've tried using the greaterThan and lessThan methods on criteria but I get
an "invalid column error" from Oracle.  I thought that perhaps the
parameters weren't getting bound to the PreparedStatement properly, but I
think I've been able to rule that out.  It appears that it's failing in the
setObject method of the Oracle driver.  I've tried to modify the
setObjectForStatement but for some reason it's still using the setObject.

I then looked at the list archives and found something about using addSql,
so I tried that.  That gave me StringOutOfBounds(-2) exceptions, with the
criteria display showing that the I added looked to be added twice with a
"null" at the end of the string (looks like this "null").  So I've
been looking at the source for the addSql method which seems to create a
SqlCriteria, all of which looks ok to me.  My guess is that the SQL
generator is getting confused or something.

I then tried setting up the criteria for the date ranges as separate
criteria.  I added the second criteria to the first as an addAndCriteria,
but instead of having just one of the "null"'s I ended up with two
of them.

Anyway what I'm looking for is someone who can give me a clue of another way
to make this work.  Or suggest somewhere in the code that I haven't looked
at yet to fix.  I'll happily upload the repository.xml and the code that
calls OJB if need be.

--mikej
-=--
mike jackson
[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: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Ralf,

Ralf Bode wrote:

Okay Armin,

will deal now with src-dist

but, why am i not able to use binary?
only for "enable" p6spy  ?
or in generall better to use SRC?

The reason is I personal only use the src-version, thus I don't know 
much about the possibilities of the binary-version.
Several ant targets only run with the src-dist. Only src-dist contains 
all junit test cases (we have about 600 junit tests).

regards,
Armin
for Struts e.g. i allways use the binary-version

greetings,
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
Ralf Bode wrote:


Hi Armin,

i used the bin-version.
how am i now able to enable p6spy?
in OJB.properties i found no key for it!
you have to use the source version.


greetings,

is it possible, that this is a bug?
(not setting the foreign-key?)
hmm, I don't think so. There was a bug when equals
and hashcode method 
of the persistence capable objects are overridden
(fixed in CVS). But 
this doesn't bother your test. Nevertheless you can
try the CVS head.

regards,
Armin

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi

Ralf,


hmm, your test is now similar to the tests in OJB
test-suite. These 
tests pass without problems (against hsql, sapDB,
mySQL,...).

How does the generated sql look like? You can use
p6spy to log all 
generated SQL. If you run your test within
OJB-suite

you only need to 
enable p6spy in build.properties file.

regards,
Armin
Ralf Bode wrote:



hallo armin,
it is the same behavor!
field "autoid" in table "kunde"
is also "null" ...
mmm (1.0rc5 - downloaded yesterday morning)
libs in classpath:
commons-collecton
commons-dbcp
commons-lang
commons-pool
db-ojb10rc5
(and mysql...) :-)

i did:

Auto auto = new Auto();
auto.setFarbe("blau");
Kunde kunde = new Kunde();
kunde.setNachname("Bode");
kunde.setVorname("Ralle");
kunde.setAuto(auto);

//OJB aktivieren!
broker.beginTransaction();
broker.store(kunde);
broker.commitTransaction();


--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
Armin, Brain and the rest :-)


hier is my code (a simple test-example)
CAR:
package de.ralle;
import java.io.Serializable;

//the CAR
public class Auto implements Serializable{
private String farbe;
public Auto() {
}
public String getFarbe() {
return farbe;
}
public void setFarbe(String string) {
farbe = string;
}
}

CUSTOMER:
package de.ralle;
import java.io.Serializable;

//my customer!
public class Kunde implements Serializable{

private String vorname;
private String nachname;
	private Auto auto;

public Kunde(){ 
}
public Auto getAuto() {
return auto;
}
public String getNachname() {
return nachname;
}
public String getVorname() {
return vorname;
}
public void setAuto(Auto auto) {
this.auto = auto;
}
public void setNachname(String string) {
nachname = string;
}
public void setVorname(String string) {
vorname = string;
}
}

and XML:


	
		id="1"
		name="id"
		column="id"
		jdbc-type="INTEGER"
		primarykey="true"
		access="anonymous"/>
	
		id="2"
		name="vorname"
		column="vorname"
		jdbc-type="VARCHAR"/>
	
		id="3"
		name="nachname"
		column="nachname"
		jdbc-type="VARCHAR"/>
	
		id="4" 
		name="autoId" 
		column="autoid" 
		jdbc-type="INTEGER"
		access="anonymous"/>

	
		auto-retrieve="true"
		auto-update="true"
		auto-delete="true">
		
	


	
=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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: oracle and dates

2004-02-03 Thread mike jackson
I found my problem.  In line 287 of StatementManager there's a setObject(
Statement, value ) call.  It was getting a java.util.Date that hadn't been
converted to a java.sql.Date.  I added a check to see if the value was an
instanceof java.util.Date and to convert it to a java.sql.Date if it is.  

--mikej
-=--
mike jackson
[EMAIL PROTECTED]



> -Original Message-
> From: mike jackson [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 03, 2004 8:37 AM
> To: 'OJB Users List'
> Subject: oracle and dates
> 
> Datebase: Oracle 8.1.7.4 or Oracle 9.2.0.4
> OJB Version:  1.0rc5
> 
> I'm having problems trying to do a search something like this:
> 
>   select * from foobar where date1 >= sysdate and date1 <= sysdate +1
> 
> I've tried using the greaterThan and lessThan methods on criteria but I
> get
> an "invalid column error" from Oracle.  I thought that perhaps the
> parameters weren't getting bound to the PreparedStatement properly, but I
> think I've been able to rule that out.  It appears that it's failing in
> the
> setObject method of the Oracle driver.  I've tried to modify the
> setObjectForStatement but for some reason it's still using the setObject.
> 
> I then looked at the list archives and found something about using addSql,
> so I tried that.  That gave me StringOutOfBounds(-2) exceptions, with the
> criteria display showing that the I added looked to be added twice with a
> "null" at the end of the string (looks like this "null").  So
> I've
> been looking at the source for the addSql method which seems to create a
> SqlCriteria, all of which looks ok to me.  My guess is that the SQL
> generator is getting confused or something.
> 
> I then tried setting up the criteria for the date ranges as separate
> criteria.  I added the second criteria to the first as an addAndCriteria,
> but instead of having just one of the "null"'s I ended up with
> two
> of them.
> 
> Anyway what I'm looking for is someone who can give me a clue of another
> way
> to make this work.  Or suggest somewhere in the code that I haven't looked
> at yet to fix.  I'll happily upload the repository.xml and the code that
> calls OJB if need be.
> 
> --mikej
> -=--
> mike jackson
> [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: Stored Procedure / returning primary key

2004-02-03 Thread Ron Gallagher
Chris --

Please provide the class descriptor that contains this insert-procedure
element.

Ron.

-Original Message-
From: Christoph Bohl [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 1:52 PM
To: [EMAIL PROTECTED]
Subject: Stored Procedure / returning primary key


Gurus,

I try to use a stored procedure to insert a table. This works perfectly. The
stored procedure does correctly return the values that get inserted into the
database.

Unfortunately, the object I am inserting does not change after the insert
(toString() before and after). Can you please point out what I am doing
wrong?
Any help is greatly appreciated!

The repository_user.xml:













  

The Java code tested (Persistence Broker API):
PersistenceBroker broker = null;
 try
 {
 broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
 broker.beginTransaction();
 broker.store(ztb);
broker.commitTransaction();
 }
 finally
 {
 if (broker != null) broker.close();
 }

ODMG API:
//  Implementation odmg = OJB.getInstance();
// Database db = odmg.newDatabase();
// try {
//
//   db.open("TABI",
Database.OPEN_READ_WRITE);
// } catch (Exception e) {
//System.out.println(e.toString());
// }
//
//  TransactionExt tx = (TransactionExt) odmg.newTransaction();
//  System.out.println("vor insertf: " + ztb.toString());
//
//  tx.begin();
//  tx.markDirty(ztb);
//  tx.commit();

Thank you very much!!

Cheers,
Chris
--
"When you were born, you were crying and everyone around you was smiling.
Live
your life so that when you die, you’re the one who is smiling and everyone
around you is crying."

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

2004-02-03 Thread Ralf Bode
Okay Armin,

will deal now with src-dist

but, why am i not able to use binary?
only for "enable" p6spy  ?

or in generall better to use SRC?

for Struts e.g. i allways use the binary-version

greetings,
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
> 
> Ralf Bode wrote:
> 
> > Hi Armin,
> > 
> > i used the bin-version.
> > how am i now able to enable p6spy?
> > in OJB.properties i found no key for it!
> > 
> 
> you have to use the source version.
> 
> > greetings,
> > 
> > is it possible, that this is a bug?
> > (not setting the foreign-key?)
> 
> hmm, I don't think so. There was a bug when equals
> and hashcode method 
> of the persistence capable objects are overridden
> (fixed in CVS). But 
> this doesn't bother your test. Nevertheless you can
> try the CVS head.
> 
> regards,
> Armin
> 
> > 
> >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi
> > Ralf,
> > 
> >>hmm, your test is now similar to the tests in OJB
> >>test-suite. These 
> >>tests pass without problems (against hsql, sapDB,
> >>mySQL,...).
> >>
> >>How does the generated sql look like? You can use
> >>p6spy to log all 
> >>generated SQL. If you run your test within
> OJB-suite
> >>you only need to 
> >>enable p6spy in build.properties file.
> >>
> >>regards,
> >>Armin
> >>
> >>Ralf Bode wrote:
> >>
> >>
> >>>hallo armin,
> >>>it is the same behavor!
> >>>field "autoid" in table "kunde"
> >>>is also "null" ...
> >>>
> >>>mmm (1.0rc5 - downloaded yesterday morning)
> >>>libs in classpath:
> >>>commons-collecton
> >>>commons-dbcp
> >>>commons-lang
> >>>commons-pool
> >>>db-ojb10rc5
> >>>
> >>>(and mysql...) :-)
> >>>
> >>>i did:
> >>>
> >>>Auto auto = new Auto();
> >>>auto.setFarbe("blau");
> >>>
> >>>Kunde kunde = new Kunde();
> >>>kunde.setNachname("Bode");
> >>>kunde.setVorname("Ralle");
> >>>kunde.setAuto(auto);
> >>>   
> >>>//OJB aktivieren!
> >>>broker.beginTransaction();
> >>>broker.store(kunde);
> >>>broker.commitTransaction();
> >>>
> >>>
> >>>
> >>>--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
> >>>Armin, Brain and the rest :-)
> >>>
> >>>
> hier is my code (a simple test-example)
> CAR:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //the CAR
> public class Auto implements Serializable{
> 
>   private String farbe;
>   public Auto() {
>   }
> 
>   public String getFarbe() {
>   return farbe;
>   }
> 
>   public void setFarbe(String string) {
>   farbe = string;
>   }
> 
> }
> 
> CUSTOMER:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //my customer!
> public class Kunde implements Serializable{
>   
> 
>   private String vorname;
>   private String nachname;
> 
>   private Auto auto;
> 
> 
>   public Kunde(){ 
>   }
> 
>   public Auto getAuto() {
>   return auto;
>   }
> 
>   public String getNachname() {
>   return nachname;
>   }
> 
>   public String getVorname() {
>   return vorname;
>   }
> 
>   public void setAuto(Auto auto) {
>   this.auto = auto;
>   }
> 
>   public void setNachname(String string) {
>   nachname = string;
>   }
> 
>   public void setVorname(String string) {
>   vorname = string;
>   }
> 
> }
> 
> and XML:
>    class="de.ralle.Kunde" 
>   table="Kunde" >
> 
>      id="1"
>   name="id"
>   column="id"
>   jdbc-type="INTEGER"
>   primarykey="true"
>   access="anonymous"/>
>      id="2"
>   name="vorname"
>   column="vorname"
>   jdbc-type="VARCHAR"/>
>      id="3"
>   name="nachname"
>   column="nachname"
>   jdbc-type="VARCHAR"/>
>      id="4" 
>   name="autoId" 
>   column="autoid" 
>   jdbc-type="INTEGER"
>   access="anonymous"/>
> 
>      name="auto" 
>   class-ref="de.ralle.Auto"
>   auto-retrieve="true"
>   auto-update="true"
>   auto-delete="true">
>   
>   
> 
>    class="de.ralle.Auto" 
>   table="auto">
>      id="1" 
>   name="id" 
>   column="id" 
>   jdbc-type="INTEGER" 
>   primarykey="true"
> 
=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de

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



oracle and dates

2004-02-03 Thread mike jackson
Datebase:   Oracle 8.1.7.4 or Oracle 9.2.0.4
OJB Version:1.0rc5

I'm having problems trying to do a search something like this:

select * from foobar where date1 >= sysdate and date1 <= sysdate +1

I've tried using the greaterThan and lessThan methods on criteria but I get
an "invalid column error" from Oracle.  I thought that perhaps the
parameters weren't getting bound to the PreparedStatement properly, but I
think I've been able to rule that out.  It appears that it's failing in the
setObject method of the Oracle driver.  I've tried to modify the
setObjectForStatement but for some reason it's still using the setObject.  

I then looked at the list archives and found something about using addSql,
so I tried that.  That gave me StringOutOfBounds(-2) exceptions, with the
criteria display showing that the I added looked to be added twice with a
"null" at the end of the string (looks like this "null").  So I've
been looking at the source for the addSql method which seems to create a
SqlCriteria, all of which looks ok to me.  My guess is that the SQL
generator is getting confused or something.

I then tried setting up the criteria for the date ranges as separate
criteria.  I added the second criteria to the first as an addAndCriteria,
but instead of having just one of the "null"'s I ended up with two
of them.  

Anyway what I'm looking for is someone who can give me a clue of another way
to make this work.  Or suggest somewhere in the code that I haven't looked
at yet to fix.  I'll happily upload the repository.xml and the code that
calls OJB if need be.

--mikej
-=--
mike jackson
[EMAIL PROTECTED]


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



Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi,

Ralf Bode wrote:

Hi Armin,

i used the bin-version.
how am i now able to enable p6spy?
in OJB.properties i found no key for it!
you have to use the source version.

greetings,

is it possible, that this is a bug?
(not setting the foreign-key?)
hmm, I don't think so. There was a bug when equals and hashcode method 
of the persistence capable objects are overridden (fixed in CVS). But 
this doesn't bother your test. Nevertheless you can try the CVS head.

regards,
Armin
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
hmm, your test is now similar to the tests in OJB
test-suite. These 
tests pass without problems (against hsql, sapDB,
mySQL,...).

How does the generated sql look like? You can use
p6spy to log all 
generated SQL. If you run your test within OJB-suite
you only need to 
enable p6spy in build.properties file.

regards,
Armin
Ralf Bode wrote:


hallo armin,
it is the same behavor!
field "autoid" in table "kunde"
is also "null" ...
mmm (1.0rc5 - downloaded yesterday morning)
libs in classpath:
commons-collecton
commons-dbcp
commons-lang
commons-pool
db-ojb10rc5
(and mysql...) :-)

i did:

Auto auto = new Auto();
auto.setFarbe("blau");
Kunde kunde = new Kunde();
kunde.setNachname("Bode");
kunde.setVorname("Ralle");
kunde.setAuto(auto);

//OJB aktivieren!
broker.beginTransaction();
broker.store(kunde);
broker.commitTransaction();


--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
Armin, Brain and the rest :-)

hier is my code (a simple test-example)
CAR:
package de.ralle;
import java.io.Serializable;

//the CAR
public class Auto implements Serializable{
private String farbe;
public Auto() {
}
public String getFarbe() {
return farbe;
}
public void setFarbe(String string) {
farbe = string;
}
}

CUSTOMER:
package de.ralle;
import java.io.Serializable;

//my customer!
public class Kunde implements Serializable{

private String vorname;
private String nachname;
	private Auto auto;

public Kunde(){ 
}
public Auto getAuto() {
return auto;
}
public String getNachname() {
return nachname;
}
public String getVorname() {
return vorname;
}
public void setAuto(Auto auto) {
this.auto = auto;
}
public void setNachname(String string) {
nachname = string;
}
public void setVorname(String string) {
vorname = string;
}
}

and XML:


	
		id="1"
		name="id"
		column="id"
		jdbc-type="INTEGER"
		primarykey="true"
		access="anonymous"/>
	
		id="2"
		name="vorname"
		column="vorname"
		jdbc-type="VARCHAR"/>
	
		id="3"
		name="nachname"
		column="nachname"
		jdbc-type="VARCHAR"/>
	
		id="4" 
		name="autoId" 
		column="autoid" 
		jdbc-type="INTEGER"
		access="anonymous"/>

	
		auto-retrieve="true"
		auto-update="true"
		auto-delete="true">
		
	


	
		access="anonymous"/>
	




THANKS!

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi

Ralf,


it does deal with anonymous fields, but only in
conjunction with 1:1 
references. Please post class-descriptor and
source


for Customer, Car.

regards,
Armin
Ralf Bode wrote:



Hi Armin.

okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.

=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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]


Broker Critera Negation weirdness

2004-02-03 Thread Brendan Richards

Hi, 

I've discovered some odd behavior exhibited by the broker criteria API
and I was wondering if anyone had come across this. 

My system is dynamically building complex queries by building criteria
objects one at a time and then pulling them together with addAndCriteria
and addOr Criteria. 

So my code looks something like this pseudocode:

Criteria criteria = new Criteria(); // create criteria object

while (myQuery.hasMoreElements()) {

Criteria c1 = new Criteria(); // new criteria
newCrit.addEqualTo("myProperty", myValue);
if (myNegation) {
c1.setNegative(true);
}
criteria.addAndCriteria(c1);
}   

So this code loops through some objects that I've created and adds a
number of criteria to a central criteria object. Each criteria may be
negated. 

My problem is that on the first call to addAndCriteria, a Criteria
object is not added to my main criteria, only a ValueCriteria. 

So say I want to do: 
WHERE  (NOT forename=brendan) AND (NOT surname IS NULL)
My code would loop twice setting values and setNegative(true) for each
sub-criteria.  

Looking at my final criteria object via getElements and printing the
types 
Using this code (with Logger being a simple class that writes output to
a file):

Enumeration critElements = criteria.getElements();
while (critElements.hasMoreElements()) {
Object testCrit = critElements.nextElement();
Logger.debugLog("type "+testCrit.getClass().getName());
if (testCrit instanceof Criteria) {
Criteria tc = (Criteria) testCrit;
if (tc.isNegative()) { 
Logger.debugLog("Criteria is negative");
}
}
} 

I get the following result in my logfile:
type org.apache.ojb.broker.query.ValueCriteria
type org.apache.ojb.broker.query.Criteria
Criteria is negative


Using criteria.toString() I get:

[forename = brendan, [surname IS NULL ]]




What this means is that I have completely LOST the isNegative value for
the first criteria I add. The containing criteria object is not negative
(I don't want it to be either I want to control the negativity of each
criteria I add).

Why does criteria.addAndCriteria convert a Criteria to ValueCriteria
when adding the first criteria losing the negative switch?

What I'd expect to see from criteria.toString() after the above code is:
[[forername = brendan], [surname IS NULL ]] - with both elements being
instances of Criteria.

Subsequent calls to addAndCriteria() after the first add Criteria
objects as you would expect.
[ forname=brendan, [surname IS NULL], [email IS NULL] ]


There is a simple dodgy workaround I could do where the first criteria I
add always evaluates to TRUE but this is far from ideal. 

Any Ideas?

Cheers, 

Brendan.


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



Anonymous Keys Warning, was Re: Installation of OJB

2004-02-03 Thread Brian McCallister
Hmm, what I get for writing docs without stepping through code 
carefully enough.

Armin has pointed out that using anonymous keys for PK's is going to 
bomb if used in a clustered environment (or anywhere that persistent 
objects are serialized and migrated) and he is completely correct!

Anyone using them as I documented in the HOWTO be warned =) I will fix 
the howto asap, but for personal reasons... that may not be as soon as 
I like =/

-Brian

On Feb 3, 2004, at 7:34 AM, Armin Waibel wrote:

Hi Ralf,

it does deal with anonymous fields, but only in conjunction with 1:1 
references. Please post class-descriptor and source for Customer, Car.

regards,
Armin
Ralf Bode wrote:

Hi Armin.
okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.
so i do like suggested in 1:1-mapping.
but then in my Beans i have
int carId
Car car;
i do now:
setCar(Car c){
car = c;
carId = c.getId();
}
but i think this is redundant, isn´t ?
now i am very confused on dealing with OJB...
a short, and last question,
why doesn´t OJB1.0.rc5 not deal with anonymous-keys
i thought its a nice feature!
greetings ralf
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
Ralf Bode wrote:

Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:

http://db.apache.org/ojb/howto-use-anonymous-keys.html
i did everything like told me :-)
the document is written nice and understandful,
doh! Assume the current implementation doesn't
achieve this. All anonymous keys are held in an internal map using 
the
object itself as key. Reading will be successful, but when the object
e.g. will be serialized and then returned to OJB the anonymous PK
field will never be found (object does not match a key), its only
possible to extract the FK from the associated reference object.
Thus I think anonymous keys will only work in
conjunction with 1:1 references.
I don't write the 'anonymous-key' stuff, so maybe I
overlooked an important argument.

regards,
Armin


but only the little thing froeign-key is null in my case...

did you know if this sample is available?
i didn´t found it in src-distribution.
thanks alot!

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi

Ralf,


but in my case the own id´s
of a class where anonymous too,
is that the matter?
AFAIK we don't have a test case that mix this
stuff.

Think it is not allowed to declare a PK field
anonymous.
Recommend you to setup a test case similar to the
examples in test suite or docu
(http://db.apache.org/ojb/tutorial3.html#Mapping
1:1

associations). As recently as your test pass start
to tweak ;-)
regards,
Armin
Ralf Bode wrote:


Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id (in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
with my (i think) foolishness)
thanks for your patience!
ralf
--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi


Ralf,



Ralf Bode wrote:



hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but
this

will definitely work with the PB-api.
You can find many examples in test suite, e.g. 
...broker.AnonymousFieldsTest.

regards,
Armin



but same...
customer is in DB, car not!
:-(
i have read in aritcle in german-javamag
on OJB there was said "all is nice"
or am i to stuid?

i though it would be possible
to store "customer" and his car...
has anyone a "runnig"-case for an idot, like
me?

thanks!



--- Brian McCallister
<[EMAIL PROTECTED]> schrieb: >
Objects



are not automatically stored by reachability




-- the car isn't inserted because it is attached to Customer.
This


*can* actually be done in the OTM if Car is a truly dependent
object


(otm-dependent attribute), but in the PB an object must be
made

explicitly persistent.

broker.store(ca);
broker.store(cu);
-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:





Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)
i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);
now only a customer was in DB

i must add the "auto-*" in descriptor:


=== message truncated === 
__
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-

Re: Installation of OJB

2004-02-03 Thread Ralf Bode
Hi Armin,

i used the bin-version.
how am i now able to enable p6spy?
in OJB.properties i found no key for it!

greetings,

is it possible, that this is a bug?
(not setting the foreign-key?)


 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
> 
> hmm, your test is now similar to the tests in OJB
> test-suite. These 
> tests pass without problems (against hsql, sapDB,
> mySQL,...).
> 
> How does the generated sql look like? You can use
> p6spy to log all 
> generated SQL. If you run your test within OJB-suite
> you only need to 
> enable p6spy in build.properties file.
> 
> regards,
> Armin
> 
> Ralf Bode wrote:
> 
> > hallo armin,
> > it is the same behavor!
> > field "autoid" in table "kunde"
> > is also "null" ...
> > 
> > mmm (1.0rc5 - downloaded yesterday morning)
> > libs in classpath:
> > commons-collecton
> > commons-dbcp
> > commons-lang
> > commons-pool
> > db-ojb10rc5
> > 
> > (and mysql...) :-)
> > 
> > i did:
> > 
> > Auto auto = new Auto();
> > auto.setFarbe("blau");
> > 
> > Kunde kunde = new Kunde();
> > kunde.setNachname("Bode");
> > kunde.setVorname("Ralle");
> > kunde.setAuto(auto);
> > 
> > //OJB aktivieren!
> > broker.beginTransaction();
> > broker.store(kunde);
> > broker.commitTransaction();
> > 
> > 
> > 
> > --- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
> > Armin, Brain and the rest :-)
> > 
> >>hier is my code (a simple test-example)
> >>CAR:
> >>package de.ralle;
> >>
> >>import java.io.Serializable;
> >>
> >>//the CAR
> >>public class Auto implements Serializable{
> >>
> >>private String farbe;
> >>public Auto() {
> >>}
> >>
> >>public String getFarbe() {
> >>return farbe;
> >>}
> >>
> >>public void setFarbe(String string) {
> >>farbe = string;
> >>}
> >>
> >>}
> >>
> >>CUSTOMER:
> >>package de.ralle;
> >>
> >>import java.io.Serializable;
> >>
> >>//my customer!
> >>public class Kunde implements Serializable{
> >>
> >>
> >>private String vorname;
> >>private String nachname;
> >>
> >>private Auto auto;
> >>
> >>
> >>public Kunde(){ 
> >>}
> >>
> >>public Auto getAuto() {
> >>return auto;
> >>}
> >>
> >>public String getNachname() {
> >>return nachname;
> >>}
> >>
> >>public String getVorname() {
> >>return vorname;
> >>}
> >>
> >>public void setAuto(Auto auto) {
> >>this.auto = auto;
> >>}
> >>
> >>public void setNachname(String string) {
> >>nachname = string;
> >>}
> >>
> >>public void setVorname(String string) {
> >>vorname = string;
> >>}
> >>
> >>}
> >>
> >>and XML:
> >> >>class="de.ralle.Kunde" 
> >>table="Kunde" >
> >>
> >> >>id="1"
> >>name="id"
> >>column="id"
> >>jdbc-type="INTEGER"
> >>primarykey="true"
> >>access="anonymous"/>
> >> >>id="2"
> >>name="vorname"
> >>column="vorname"
> >>jdbc-type="VARCHAR"/>
> >> >>id="3"
> >>name="nachname"
> >>column="nachname"
> >>jdbc-type="VARCHAR"/>
> >> >>id="4" 
> >>name="autoId" 
> >>column="autoid" 
> >>jdbc-type="INTEGER"
> >>access="anonymous"/>
> >>
> >> >>name="auto" 
> >>class-ref="de.ralle.Auto"
> >>auto-retrieve="true"
> >>auto-update="true"
> >>auto-delete="true">
> >>
> >>
> >>
> >> >>class="de.ralle.Auto" 
> >>table="auto">
> >> >>id="1" 
> >>name="id" 
> >>column="id" 
> >>jdbc-type="INTEGER" 
> >>primarykey="true"
> >>access="anonymous"/>
> >> >>id="2" 
> >>name="farbe" 
> >>column="farbe" 
> >>jdbc-type="VARCHAR" />
> >>
> >>
> >>
> >>
> >>THANKS!
> >>
> >> --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi
> >>Ralf,
> >>
> >>>it does deal with anonymous fields, but only in
> >>>conjunction with 1:1 
> >>>references. Please post class-descriptor and
> >>
> >>source
> >>
> >>>for Customer, Car.
> >>>
> >>>regards,
> >>>Armin
> >>>
> >>>Ralf Bode wrote:
> >>>
> >>>
> Hi Armin.
> 
> okay i didn´t know about 1.0rc5 isn´t
> dealing with anonymous-keys.
> 
=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de

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



patch for org.apache.ojb.broker.util.SqlHelper class

2004-02-03 Thread Andrew Geery
I recently upgraded from 1.0.rc4 to 1.0.rc5. This broke some code I had 
written that used the method 
org.apache.ojb.broker.query.Criteria.addSql(String). The SQL I added was 
of the form: soundex(value) = soundex(column). This resulted in an 
java.lang.ArrayIndexOutOfBoundsException being thrown by the 
org.apache.ojb.broker.util.SqlHelper.splitPath(String) method because 
the braceBegin variable was greater than the braceEnd variable. In 
addition to the check that both braceEnd and braceBegin are at least 
zero, there should be a check that braceEnd is, in fact, bigger than 
braceBegin.

The patch is below.

Thanks
Andrew
Index: SqlHelper.java
===
RCS file: 
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/util/SqlHelper.java,v
retrieving revision 1.21
diff -u -r1.21 SqlHelper.java
--- SqlHelper.java12 Dec 2003 16:30:37 -1.21
+++ SqlHelper.java3 Feb 2004 14:23:44 -
@@ -122,7 +122,7 @@
int braceBegin = aPath.lastIndexOf("(");
int braceEnd = aPath.indexOf(")");

-if (braceBegin >= 0 && braceEnd >= 0)
+if (braceBegin >= 0 && braceEnd >= 0 && braceEnd > braceBegin)
{
int colBegin;
int colEnd;


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


RE: Installation of OJB

2004-02-03 Thread Daniel Perry
This has brought up an interesting question for me.
I am NOT using any anonymous keys, but i like the principle of them.
The majority of my work is web-based.  Therefore, by not having PKIDs it's
much harder to pass references between requests.
Does anyone have any simple solutions to this problem?

My solution was to store the objects in a hashmap in the session, then pass
the key through html requests.
However, this does make transactions more painful, and it means that you are
storing the retrieved persistant object (whole tree if not proxied) in the
session until it is removed or until the session expires.  This can use a
lot of memory.

I've found it a much cleaner approach in web apps to use ids.  Provide a
service that hands out objects referenced by id or lists of objects when
requested (ie getPerson(int id)) and updates objects using the new data (not
objects) and an id (eg updatePerson(int personId, String newName, String
newJobTitle,...)).

Any thoughts?

Daniel.

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: 03 February 2004 12:34
To: OJB Users List
Subject: Re: Installation of OJB


Hi Ralf,

it does deal with anonymous fields, but only in conjunction with 1:1
references. Please post class-descriptor and source for Customer, Car.

regards,
Armin

Ralf Bode wrote:

> Hi Armin.
>
> okay i didn´t know about 1.0rc5 isn´t
> dealing with anonymous-keys.
>
> so i do like suggested in 1:1-mapping.
>
> but then in my Beans i have
> int carId
> Car car;
>
> i do now:
> setCar(Car c){
> car = c;
> carId = c.getId();
> }
>
> but i think this is redundant, isn´t ?
> now i am very confused on dealing with OJB...
>
> a short, and last question,
> why doesn´t OJB1.0.rc5 not deal with anonymous-keys
> i thought its a nice feature!
>
> greetings ralf
>
>
>  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
>
>>Ralf Bode wrote:
>>
>>>Hi Armin,
>>>thanks for your patience, first!
>>>but the things with declaring PK_Fields
>>>i read at:
>>>
>>
> http://db.apache.org/ojb/howto-use-anonymous-keys.html
>
>>>i did everything like told me :-)
>>>the document is written nice and understandful,
>>
>>doh! Assume the current implementation doesn't
>>achieve this. All
>>anonymous keys are held in an internal map using the
>>object itself as
>>key. Reading will be successful, but when the object
>>e.g. will be
>>serialized and then returned to OJB the anonymous PK
>>field will never be
>>found (object does not match a key), its only
>>possible to extract the FK
>>from the associated reference object.
>>Thus I think anonymous keys will only work in
>>conjunction with 1:1
>>references.
>>I don't write the 'anonymous-key' stuff, so maybe I
>>overlooked an
>>important argument.
>>
>>regards,
>>Armin
>>
>>
>>
>>>but only the little thing
>>>froeign-key is null in my case...
>>>
>>>did you know if this sample is available?
>>>i didn´t found it in src-distribution.
>>>
>>>thanks alot!
>>>
>>> --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
>>
>>Hi
>>
>>>Ralf,
>>>
>>>
>but in my case the own id´s
>of a class where anonymous too,
>is that the matter?

AFAIK we don't have a test case that mix this
>>
>>stuff.
>>
Think it is not allowed to declare a PK field
anonymous.
Recommend you to setup a test case similar to the
examples in test suite
or docu
(http://db.apache.org/ojb/tutorial3.html#Mapping
>>
>>1:1
>>
associations). As recently as your test pass start
to tweak ;-)

regards,
Armin


Ralf Bode wrote:


>Hi Armin, again...
>...sorry...
>
>i looked in samples you told me!
>(thanks for tipps!)
>but i have all so like
>1:1-relationship
>org.apache.ojb.broker.ObjectRepository$Group
>org.apache.ojb.broker.ObjectRepository$Componente
>(access="anonymous" for reffered ids)
>but in my case the own id´s
>of a class where anonymous too,
>is that the matter?
>but i don´t think so, because
>for car and customer a id is "generated".
>
>But only!!! the reffered id
>(in customer for car is "null")
>
>...strangely... isn´t it ?
>
>perhaps i can send it to list / to you?
>(i asked, because i will not blow up list
> with my (i think) foolishness)
>
>thanks for your patience!
>ralf
>--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >

Hi


>Ralf,
>
>
>
>>Ralf Bode wrote:
>>
>>
>>
>>>hi ... again :-(
>>>
>>>it is really frustratingly...
>>>i turned OTM->true
>>>made:
>>>customer.setCar(car)
>>>broker.store(customer);
>>>
>>
>>I don't know what's wrong with your test, but
>>
>>this
>>
>>will definitely work
>>with the PB-api.
>>You can find many examples in test suite, e.g.
>>...broker.AnonymousFieldsTest.
>>
>>regards,
>>Armin
>>
>>
>>
>>
>>>but same...
>>>customer is in DB, car not!
>>>:

Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Ralf,

hmm, your test is now similar to the tests in OJB test-suite. These 
tests pass without problems (against hsql, sapDB, mySQL,...).

How does the generated sql look like? You can use p6spy to log all 
generated SQL. If you run your test within OJB-suite you only need to 
enable p6spy in build.properties file.

regards,
Armin
Ralf Bode wrote:

hallo armin,
it is the same behavor!
field "autoid" in table "kunde"
is also "null" ...
mmm (1.0rc5 - downloaded yesterday morning)
libs in classpath:
commons-collecton
commons-dbcp
commons-lang
commons-pool
db-ojb10rc5
(and mysql...) :-)

i did:

Auto auto = new Auto();
auto.setFarbe("blau");
Kunde kunde = new Kunde();
kunde.setNachname("Bode");
kunde.setVorname("Ralle");
kunde.setAuto(auto);

//OJB aktivieren!
broker.beginTransaction();
broker.store(kunde);
broker.commitTransaction();


--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
Armin, Brain and the rest :-)
hier is my code (a simple test-example)
CAR:
package de.ralle;
import java.io.Serializable;

//the CAR
public class Auto implements Serializable{
private String farbe;
public Auto() {
}
public String getFarbe() {
return farbe;
}
public void setFarbe(String string) {
farbe = string;
}
}

CUSTOMER:
package de.ralle;
import java.io.Serializable;

//my customer!
public class Kunde implements Serializable{

private String vorname;
private String nachname;
	private Auto auto;

public Kunde(){ 
}
public Auto getAuto() {
return auto;
}
public String getNachname() {
return nachname;
}
public String getVorname() {
return vorname;
}
public void setAuto(Auto auto) {
this.auto = auto;
}
public void setNachname(String string) {
nachname = string;
}
public void setVorname(String string) {
vorname = string;
}
}

and XML:


	
		id="1"
		name="id"
		column="id"
		jdbc-type="INTEGER"
		primarykey="true"
		access="anonymous"/>
	
		id="2"
		name="vorname"
		column="vorname"
		jdbc-type="VARCHAR"/>
	
		id="3"
		name="nachname"
		column="nachname"
		jdbc-type="VARCHAR"/>
	
		id="4" 
		name="autoId" 
		column="autoid" 
		jdbc-type="INTEGER"
		access="anonymous"/>

	
		auto-retrieve="true"
		auto-update="true"
		auto-delete="true">
		
	


	
		access="anonymous"/>
	




THANKS!

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
it does deal with anonymous fields, but only in
conjunction with 1:1 
references. Please post class-descriptor and
source

for Customer, Car.

regards,
Armin
Ralf Bode wrote:


Hi Armin.

okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.
so i do like suggested in 1:1-mapping.

but then in my Beans i have
int carId
Car car;
i do now:
setCar(Car c){
car = c;
carId = c.getId();
}
but i think this is redundant, isn´t ?
now i am very confused on dealing with OJB...
a short, and last question,
why doesn´t OJB1.0.rc5 not deal with
anonymous-keys

i thought its a nice feature!

greetings ralf

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi,

Ralf Bode wrote:


Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:

http://db.apache.org/ojb/howto-use-anonymous-keys.html

i did everything like told me :-)
the document is written nice and understandful,
doh! Assume the current implementation doesn't
achieve this. All 
anonymous keys are held in an internal map using
the

object itself as 
key. Reading will be successful, but when the
object

e.g. will be 
serialized and then returned to OJB the
anonymous

PK

field will never be 
found (object does not match a key), its only

=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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: Installation of OJB

2004-02-03 Thread Ralf Bode
hallo armin,
it is the same behavor!
field "autoid" in table "kunde"
is also "null" ...

mmm (1.0rc5 - downloaded yesterday morning)
libs in classpath:
commons-collecton
commons-dbcp
commons-lang
commons-pool
db-ojb10rc5

(and mysql...) :-)

i did:

Auto auto = new Auto();
auto.setFarbe("blau");

Kunde kunde = new Kunde();
kunde.setNachname("Bode");
kunde.setVorname("Ralle");
kunde.setAuto(auto);

//OJB aktivieren!
broker.beginTransaction();
broker.store(kunde);
broker.commitTransaction();



--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
Armin, Brain and the rest :-)
> 
> hier is my code (a simple test-example)
> CAR:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //the CAR
> public class Auto implements Serializable{
> 
>   private String farbe;
>   public Auto() {
>   }
> 
>   public String getFarbe() {
>   return farbe;
>   }
> 
>   public void setFarbe(String string) {
>   farbe = string;
>   }
> 
> }
> 
> CUSTOMER:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //my customer!
> public class Kunde implements Serializable{
>   
> 
>   private String vorname;
>   private String nachname;
> 
>   private Auto auto;
> 
> 
>   public Kunde(){ 
>   }
> 
>   public Auto getAuto() {
>   return auto;
>   }
> 
>   public String getNachname() {
>   return nachname;
>   }
> 
>   public String getVorname() {
>   return vorname;
>   }
> 
>   public void setAuto(Auto auto) {
>   this.auto = auto;
>   }
> 
>   public void setNachname(String string) {
>   nachname = string;
>   }
> 
>   public void setVorname(String string) {
>   vorname = string;
>   }
> 
> }
> 
> and XML:
>class="de.ralle.Kunde" 
>   table="Kunde" >
> 
>  id="1"
>   name="id"
>   column="id"
>   jdbc-type="INTEGER"
>   primarykey="true"
>   access="anonymous"/>
>  id="2"
>   name="vorname"
>   column="vorname"
>   jdbc-type="VARCHAR"/>
>  id="3"
>   name="nachname"
>   column="nachname"
>   jdbc-type="VARCHAR"/>
>  id="4" 
>   name="autoId" 
>   column="autoid" 
>   jdbc-type="INTEGER"
>   access="anonymous"/>
> 
>  name="auto" 
>   class-ref="de.ralle.Auto"
>   auto-retrieve="true"
>   auto-update="true"
>   auto-delete="true">
>   
>   
> 
>class="de.ralle.Auto" 
>   table="auto">
>  id="1" 
>   name="id" 
>   column="id" 
>   jdbc-type="INTEGER" 
>   primarykey="true"
>   access="anonymous"/>
>  id="2" 
>   name="farbe" 
>   column="farbe" 
>   jdbc-type="VARCHAR" />
> 
> 
> 
> 
> THANKS!
> 
>  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
> Ralf,
> > 
> > it does deal with anonymous fields, but only in
> > conjunction with 1:1 
> > references. Please post class-descriptor and
> source
> > for Customer, Car.
> > 
> > regards,
> > Armin
> > 
> > Ralf Bode wrote:
> > 
> > > Hi Armin.
> > > 
> > > okay i didn´t know about 1.0rc5 isn´t
> > > dealing with anonymous-keys.
> > > 
> > > so i do like suggested in 1:1-mapping.
> > > 
> > > but then in my Beans i have
> > > int carId
> > > Car car;
> > > 
> > > i do now:
> > > setCar(Car c){
> > > car = c;
> > > carId = c.getId();
> > > }
> > > 
> > > but i think this is redundant, isn´t ?
> > > now i am very confused on dealing with OJB...
> > > 
> > > a short, and last question,
> > > why doesn´t OJB1.0.rc5 not deal with
> > anonymous-keys
> > > i thought its a nice feature!
> > > 
> > > greetings ralf
> > > 
> > > 
> > >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> > Hi,
> > > 
> > >>Ralf Bode wrote:
> > >>
> > >>>Hi Armin,
> > >>>thanks for your patience, first!
> > >>>but the things with declaring PK_Fields
> > >>>i read at:
> > >>>
> > >>
> > >
> >
>
http://db.apache.org/ojb/howto-use-anonymous-keys.html
> > > 
> > >>>i did everything like told me :-)
> > >>>the document is written nice and understandful,
> > >>
> > >>doh! Assume the current implementation doesn't
> > >>achieve this. All 
> > >>anonymous keys are held in an internal map using
> > the
> > >>object itself as 
> > >>key. Reading will be successful, but when the
> > object
> > >>e.g. will be 
> > >>serialized and then returned to OJB the
> anonymous
> > PK
> > >>field will never be 
> > >>found (object does not match a key), its only
> 
=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alle

Memory problems using default cache

2004-02-03 Thread Guillaume Nodet
When using the default cache implementation, i run out of memory when
performing a great amount of object storings with ojb. I saw a post some
weeks ago saying that someone ran into the same problem. An idea was that
the cache keys were not garbaged, even if objects were (via SoftReference).
I also saw that there was an implementation of a LRU cache that was begun
(ObjectCacheSoftImpl). I added the right constructor to it, and used it. It
seems to work great. So my question is: will this ObjectCacheSoftImpl class
will be supported, or should i continue to use my own derived implementation
?

Guillaume Nodet



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



Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Ralf,

Ralf Bode wrote:

Hi Armin, Brain and the rest :-)

hier is my code (a simple test-example)
CAR:
ok, from my knowledge you should do

package de.ralle;

import java.io.Serializable;

//the CAR
public class Auto implements Serializable{

private Integer id;
private String farbe;
public Auto() {
}
public String getFarbe() {
return farbe;
}
public void setFarbe(String string) {
farbe = string;
}
}

CUSTOMER:
package de.ralle;
import java.io.Serializable;

//my customer!
public class Kunde implements Serializable{


private Integer id;
private String vorname;
	private String nachname;

	private Auto auto;

public Kunde(){ 
}
public Auto getAuto() {
return auto;
}
public String getNachname() {
return nachname;
}
public String getVorname() {
return vorname;
}
public void setAuto(Auto auto) {
this.auto = auto;
}
public void setNachname(String string) {
nachname = string;
}
public void setVorname(String string) {
vorname = string;
}
}

and XML:




remove line access="anonymous"

	/>
	
		id="2"
		name="vorname"
		column="vorname"
		jdbc-type="VARCHAR"/>
	
		id="3"
		name="nachname"
		column="nachname"
		jdbc-type="VARCHAR"/>
	
		id="4" 
		name="autoId" 
		column="autoid" 
		jdbc-type="INTEGER"
		access="anonymous"/>

	
		auto-retrieve="true"
		auto-update="true"
		auto-delete="true">
		
	





	remove line access="anonymous"

	/>
	

Then try

Kunde k = new Kunde();
..
Auto a = new Auto();
...
k.setAuto(a);
...
broker.beginTransaction();
broker.store(k);
broker.commitTransaction();

regards,
Armin


THANKS!

 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
it does deal with anonymous fields, but only in
conjunction with 1:1 
references. Please post class-descriptor and source
for Customer, Car.

regards,
Armin
Ralf Bode wrote:


Hi Armin.

okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.
so i do like suggested in 1:1-mapping.

but then in my Beans i have
int carId
Car car;
i do now:
setCar(Car c){
car = c;
carId = c.getId();
}
but i think this is redundant, isn´t ?
now i am very confused on dealing with OJB...
a short, and last question,
why doesn´t OJB1.0.rc5 not deal with
anonymous-keys

i thought its a nice feature!

greetings ralf

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi,

Ralf Bode wrote:


Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:

http://db.apache.org/ojb/howto-use-anonymous-keys.html

i did everything like told me :-)
the document is written nice and understandful,
doh! Assume the current implementation doesn't
achieve this. All 
anonymous keys are held in an internal map using
the

object itself as 
key. Reading will be successful, but when the
object

e.g. will be 
serialized and then returned to OJB the anonymous
PK

field will never be 
found (object does not match a key), its only
possible to extract the FK 

from the associated reference object.

Thus I think anonymous keys will only work in
conjunction with 1:1 
references.
I don't write the 'anonymous-key' stuff, so maybe
I

overlooked an 
important argument.

regards,
Armin



but only the little thing 
froeign-key is null in my case...

did you know if this sample is available?
i didn´t found it in src-distribution.
thanks alot!

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi


Ralf,



but in my case the own id´s
of a class where anonymous too,
is that the matter?
AFAIK we don't have a test case that mix this
stuff.


Think it is not allowed to declare a PK field
anonymous.
Recommend you to setup a test case similar to
the

examples in test suite 
or docu
(http://db.apache.org/ojb/tutorial3.html#Mapping
1:1


associations). As recently as your test pass
start

to tweak ;-)

regards,
Armin
Ralf Bode wrote:



Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group

org.apache.ojb.broker.ObjectRepository$Componente

(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id 
(in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
with my (i think) foolishness)
thanks for your patience!
ralf
--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi



Ralf,




Ralf Bode wrote:




hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but
this


will definitely work 
with the PB-api.
You can find man

Re: Installation of OJB

2004-02-03 Thread Ralf Bode
Hi Armin, Brain and the rest :-)

hier is my code (a simple test-example)
CAR:
package de.ralle;

import java.io.Serializable;

//the CAR
public class Auto implements Serializable{

private String farbe;
public Auto() {
}

public String getFarbe() {
return farbe;
}

public void setFarbe(String string) {
farbe = string;
}

}

CUSTOMER:
package de.ralle;

import java.io.Serializable;

//my customer!
public class Kunde implements Serializable{


private String vorname;
private String nachname;

private Auto auto;


public Kunde(){ 
}

public Auto getAuto() {
return auto;
}

public String getNachname() {
return nachname;
}

public String getVorname() {
return vorname;
}

public void setAuto(Auto auto) {
this.auto = auto;
}

public void setNachname(String string) {
nachname = string;
}

public void setVorname(String string) {
vorname = string;
}

}

and XML:


















THANKS!

 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
> 
> it does deal with anonymous fields, but only in
> conjunction with 1:1 
> references. Please post class-descriptor and source
> for Customer, Car.
> 
> regards,
> Armin
> 
> Ralf Bode wrote:
> 
> > Hi Armin.
> > 
> > okay i didn´t know about 1.0rc5 isn´t
> > dealing with anonymous-keys.
> > 
> > so i do like suggested in 1:1-mapping.
> > 
> > but then in my Beans i have
> > int carId
> > Car car;
> > 
> > i do now:
> > setCar(Car c){
> > car = c;
> > carId = c.getId();
> > }
> > 
> > but i think this is redundant, isn´t ?
> > now i am very confused on dealing with OJB...
> > 
> > a short, and last question,
> > why doesn´t OJB1.0.rc5 not deal with
> anonymous-keys
> > i thought its a nice feature!
> > 
> > greetings ralf
> > 
> > 
> >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi,
> > 
> >>Ralf Bode wrote:
> >>
> >>>Hi Armin,
> >>>thanks for your patience, first!
> >>>but the things with declaring PK_Fields
> >>>i read at:
> >>>
> >>
> >
>
http://db.apache.org/ojb/howto-use-anonymous-keys.html
> > 
> >>>i did everything like told me :-)
> >>>the document is written nice and understandful,
> >>
> >>doh! Assume the current implementation doesn't
> >>achieve this. All 
> >>anonymous keys are held in an internal map using
> the
> >>object itself as 
> >>key. Reading will be successful, but when the
> object
> >>e.g. will be 
> >>serialized and then returned to OJB the anonymous
> PK
> >>field will never be 
> >>found (object does not match a key), its only
> >>possible to extract the FK 
> >>from the associated reference object.
> >>Thus I think anonymous keys will only work in
> >>conjunction with 1:1 
> >>references.
> >>I don't write the 'anonymous-key' stuff, so maybe
> I
> >>overlooked an 
> >>important argument.
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>
> >>>but only the little thing 
> >>>froeign-key is null in my case...
> >>>
> >>>did you know if this sample is available?
> >>>i didn´t found it in src-distribution.
> >>>
> >>>thanks alot!
> >>>
> >>> --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> >>
> >>Hi
> >>
> >>>Ralf,
> >>>
> >>>
> >but in my case the own id´s
> >of a class where anonymous too,
> >is that the matter?
> 
> AFAIK we don't have a test case that mix this
> >>
> >>stuff.
> >>
> Think it is not allowed to declare a PK field
> anonymous.
> Recommend you to setup a test case similar to
> the
> examples in test suite 
> or docu
> (http://db.apache.org/ojb/tutorial3.html#Mapping
> >>
> >>1:1
> >>
> associations). As recently as your test pass
> start
> to tweak ;-)
> 
> regards,
> Armin
> 
> 
> Ralf Bode wrote:
> 
> 
> >Hi Armin, again...
> >...sorry...
> >
> >i looked in samples you told me!
> >(thanks for tipps!)
> >but i have all so like
> >1:1-relationship
> >org.apache.ojb.broker.ObjectRepository$Group
>
>org.apache.ojb.broker.ObjectRepository$Componente
> >(access="anonymous" for reffered ids)
> >but in my case the own id´s
> >of a class where anonymous too,
> >is that the matter?
> >but i don´t think so, because
> >for car and customer a id is "generated".
> >
> >But only!!! the reffered id 
> >(in customer for car is "null")
> >
> >...strangely... isn´t it ?
> >
> >perhaps i can send it to list / to you?
> >(i asked, because i will not blow up list
> > with my (i think) foolishness)
> >
> >thanks for your patience!
> >ralf
> >--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> 
> Hi
> 
> 
> >Ralf,
> >
> >
> >
> 

Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Brian,

Brian McCallister wrote:

On Feb 3, 2004, at 7:03 AM, Armin Waibel wrote:

doh! Assume the current implementation doesn't achieve this.


?! See my previous post. Also, the code in the howto was tested!
Can you show me an test were a PK field was declared anonymous. I have 
written some test cases for anonymous fields, but only using anonymous 
attributes for the fk id field of the reference.

regards,
Armin
-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: Installation of OJB

2004-02-03 Thread Ralf Bode
hi brain,
an example would be nice,

i know, that i can not access an anonymous-key
in java :-)

the reason why i find this useful is, because of
having clean JavaBeans for database.
not blown up with eg carId (when i am also reffering
to a car)

but armin told, that anonymous-keys not available in
1.0.rc5..?

now i am really confused :-)

greetings
ralf

 --- Brian McCallister
<[EMAIL PROTECTED]> schrieb: > I declare
PK's anonymous quite frequently. I will
> post an example when 
> I get in to work =) Basically it works just like
> normal, you still 
> refer to it by the name attribute (though I tend to
> use THIS_STYLE for 
> names for anon keys to make sure it is clear you
> cannot de-reference 
> them in the Java.
> 
> -Brian
> 
> On Feb 3, 2004, at 6:10 AM, Armin Waibel wrote:
> 
> > Hi Ralf,
> >
> > > but in my case the own id´s
> > > of a class where anonymous too,
> > > is that the matter?
> >
> > AFAIK we don't have a test case that mix this
> stuff.
> > Think it is not allowed to declare a PK field
> anonymous.
> > Recommend you to setup a test case similar to the
> examples in test 
> > suite or docu
> (http://db.apache.org/ojb/tutorial3.html#Mapping 1:1
> 
> > associations). As recently as your test pass start
> to tweak ;-)
> >
> > regards,
> > Armin
> >
> >
> > Ralf Bode wrote:
> >> Hi Armin, again...
> >> ...sorry...
> >> i looked in samples you told me!
> >> (thanks for tipps!)
> >> but i have all so like
> >> 1:1-relationship
> >> org.apache.ojb.broker.ObjectRepository$Group
> >> org.apache.ojb.broker.ObjectRepository$Componente
> >> (access="anonymous" for reffered ids)
> >> but in my case the own id´s
> >> of a class where anonymous too,
> >> is that the matter?
> >> but i don´t think so, because
> >> for car and customer a id is "generated".
> >> But only!!! the reffered id (in customer for car
> is "null")
> >> ...strangely... isn´t it ?
> >> perhaps i can send it to list / to you?
> >> (i asked, because i will not blow up list
> >>   with my (i think) foolishness)
> >> thanks for your patience!
> >> ralf
> >>  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi
> >> Ralf,
> >>> Ralf Bode wrote:
> >>>
>  hi ... again :-(
> 
>  it is really frustratingly...
>  i turned OTM->true
>  made:
>  customer.setCar(car)
>  broker.store(customer);
> 
> >>>
> >>> I don't know what's wrong with your test, but
> this
> >>> will definitely work with the PB-api.
> >>> You can find many examples in test suite, e.g. 
> >>> ...broker.AnonymousFieldsTest.
> >>>
> >>> regards,
> >>> Armin
> >>>
> >>>
>  but same...
>  customer is in DB, car not!
>  :-(
> 
>  i have read in aritcle in german-javamag
>  on OJB there was said "all is nice"
> 
>  or am i to stuid?
> 
>  i though it would be possible
>  to store "customer" and his car...
>  has anyone a "runnig"-case for an idot, like
> me?
> 
>  thanks!
> 
> 
> 
> 
>  --- Brian McCallister
>  <[EMAIL PROTECTED]> schrieb: >
> >>>
> >>> Objects
> >>>
>  are not automatically stored by reachability
> 
> 
> > -- the car isn't inserted because it is
> attached to Customer. This
> > *can* actually be done in the OTM if Car is a
> truly dependent 
> > object
> > (otm-dependent attribute), but in the PB an
> object must be made
> > explicitly persistent.
> >
> > broker.store(ca);
> > broker.store(cu);
> >
> > -Brian
> >
> > On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:
> >
> >
> >
> >> Hi Brian,
> >> now i got an "anonym" id
> >> (very nice, so i now have "pure" javaBeans
> >> no technicals in it :-)
> >>
> >> i made
> >> cu = new Custiomer();
> >> ca = new Car();
> >> cu.setCar(ca);
> >> broker.store(cu);
> >>
> >> now only a customer was in DB
> >>
> >> i must add the "auto-*" in descriptor:
> >>  >> name="car"
> >> class-ref="de.ralle.Car"
> >> auto-retrive="true"
> >> auto-update="true"
> >> auto-delete="true">
> >> 
> >> 
> >>
> >> now i have a car and a customer,
> >> but custumer.carId is "null" in database...
> >> of course carId is anonym too! ...
> >>
> >> any idea? or am i to silly
> >> and i must do pure sql ... as a penalty... ?
> :-)
> >>
> >>
> >> in table customer is:
> >> CREATE TABLE CUSTOMER
> >> (
> >>   ID INT PRIMARY KEY AUTO_INCREMENT,
> >>   CARID INT,
> >>   FOREIGN KEY (CARID) REFERENCES CAR(ID)
> >> );
> >>
> >> thanks!
> >>
> >> --- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
> >
> > Thanks
> >
> >
> >> Brian,
> >>
> >>
> >>> but do you mean with "anonymous" keys ?
> >>>
> >>> now i have (in classes):
> >>> CUSTOMER
> >>> car: Car
> >>> carId: int
> >>>
> >>> CAR:
> >>> id: int
> >>>
> >>> (and the XML desc for it l

Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Ralf,

it does deal with anonymous fields, but only in conjunction with 1:1 
references. Please post class-descriptor and source for Customer, Car.

regards,
Armin
Ralf Bode wrote:

Hi Armin.

okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.
so i do like suggested in 1:1-mapping.

but then in my Beans i have
int carId
Car car;
i do now:
setCar(Car c){
car = c;
carId = c.getId();
}
but i think this is redundant, isn´t ?
now i am very confused on dealing with OJB...
a short, and last question,
why doesn´t OJB1.0.rc5 not deal with anonymous-keys
i thought its a nice feature!
greetings ralf

 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,

Ralf Bode wrote:

Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:

http://db.apache.org/ojb/howto-use-anonymous-keys.html

i did everything like told me :-)
the document is written nice and understandful,
doh! Assume the current implementation doesn't
achieve this. All 
anonymous keys are held in an internal map using the
object itself as 
key. Reading will be successful, but when the object
e.g. will be 
serialized and then returned to OJB the anonymous PK
field will never be 
found (object does not match a key), its only
possible to extract the FK 
from the associated reference object.
Thus I think anonymous keys will only work in
conjunction with 1:1 
references.
I don't write the 'anonymous-key' stuff, so maybe I
overlooked an 
important argument.

regards,
Armin


but only the little thing 
froeign-key is null in my case...

did you know if this sample is available?
i didn´t found it in src-distribution.
thanks alot!

--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi

Ralf,


but in my case the own id´s
of a class where anonymous too,
is that the matter?
AFAIK we don't have a test case that mix this
stuff.

Think it is not allowed to declare a PK field
anonymous.
Recommend you to setup a test case similar to the
examples in test suite 
or docu
(http://db.apache.org/ojb/tutorial3.html#Mapping
1:1

associations). As recently as your test pass start
to tweak ;-)
regards,
Armin
Ralf Bode wrote:


Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id 
(in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
with my (i think) foolishness)
thanks for your patience!
ralf
--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi


Ralf,



Ralf Bode wrote:



hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but
this

will definitely work 
with the PB-api.
You can find many examples in test suite, e.g. 
...broker.AnonymousFieldsTest.

regards,
Armin



but same...
customer is in DB, car not!
:-(
i have read in aritcle in german-javamag
on OJB there was said "all is nice"
or am i to stuid?

i though it would be possible
to store "customer" and his car...
has anyone a "runnig"-case for an idot, like
me?

thanks!



--- Brian McCallister
<[EMAIL PROTECTED]> schrieb: >
Objects



are not automatically stored by reachability




-- the car isn't 
inserted because it is attached to Customer.
This


*can* actually be 
done in the OTM if Car is a truly dependent
object


(otm-dependent 
attribute), but in the PB an object must be
made

explicitly persistent.

broker.store(ca);
broker.store(cu);
-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:





Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)
i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);
now only a customer was in DB

i must add the "auto-*" in descriptor:


=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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: Installation of OJB

2004-02-03 Thread Brian McCallister
On Feb 3, 2004, at 7:03 AM, Armin Waibel wrote:
doh! Assume the current implementation doesn't achieve this.
?! See my previous post. Also, the code in the howto was tested!

-Brian



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


Re: Installation of OJB

2004-02-03 Thread Brian McCallister
I declare PK's anonymous quite frequently. I will post an example when 
I get in to work =) Basically it works just like normal, you still 
refer to it by the name attribute (though I tend to use THIS_STYLE for 
names for anon keys to make sure it is clear you cannot de-reference 
them in the Java.

-Brian

On Feb 3, 2004, at 6:10 AM, Armin Waibel wrote:

Hi Ralf,

> but in my case the own id´s
> of a class where anonymous too,
> is that the matter?
AFAIK we don't have a test case that mix this stuff.
Think it is not allowed to declare a PK field anonymous.
Recommend you to setup a test case similar to the examples in test 
suite or docu (http://db.apache.org/ojb/tutorial3.html#Mapping 1:1 
associations). As recently as your test pass start to tweak ;-)

regards,
Armin
Ralf Bode wrote:
Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id (in customer for car is "null")
...strangely... isn´t it ?
perhaps i can send it to list / to you?
(i asked, because i will not blow up list
  with my (i think) foolishness)
thanks for your patience!
ralf
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
Ralf Bode wrote:

hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but this
will definitely work with the PB-api.
You can find many examples in test suite, e.g. 
...broker.AnonymousFieldsTest.

regards,
Armin

but same...
customer is in DB, car not!
:-(
i have read in aritcle in german-javamag
on OJB there was said "all is nice"
or am i to stuid?

i though it would be possible
to store "customer" and his car...
has anyone a "runnig"-case for an idot, like me?
thanks!



--- Brian McCallister
<[EMAIL PROTECTED]> schrieb: >
Objects

are not automatically stored by reachability


-- the car isn't inserted because it is attached to Customer. This
*can* actually be done in the OTM if Car is a truly dependent 
object
(otm-dependent attribute), but in the PB an object must be made
explicitly persistent.

broker.store(ca);
broker.store(cu);
-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:



Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)
i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);
now only a customer was in DB

i must add the "auto-*" in descriptor:



now i have a car and a customer,
but custumer.carId is "null" in database...
of course carId is anonym too! ...
any idea? or am i to silly
and i must do pure sql ... as a penalty... ? :-)
in table customer is:
CREATE TABLE CUSTOMER
(
  ID INT PRIMARY KEY AUTO_INCREMENT,
  CARID INT,
  FOREIGN KEY (CARID) REFERENCES CAR(ID)
);
thanks!

--- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
Thanks


Brian,


but do you mean with "anonymous" keys ?

now i have (in classes):
CUSTOMER
car: Car
carId: int
CAR:
id: int
(and the XML desc for it like in mail before)
am i with anon.keys able to "see" car-fk in
database-table CUSTOMER?
after:
broker.store(customer); ?
thanks again, and thanks for your patience.
greetings!




On the FK thing, if you do not use anonymous
FK's


the ID's need to be
managed manually, as well as the references. I
tend


to recommend using
anonymous keys for FK relationships because it
is


very easy to forget
this.
-Brian





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


__
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles:
http://suche.yahoo.de


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


__
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles:
http://suche.yahoo.de


-
To unsubscribe, e-mail:
[EMAIL PROTECTED]


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


=== message truncated === 
__
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Installation of OJB

2004-02-03 Thread Ralf Bode
Hi Armin.

okay i didn´t know about 1.0rc5 isn´t
dealing with anonymous-keys.

so i do like suggested in 1:1-mapping.

but then in my Beans i have
int carId
Car car;

i do now:
setCar(Car c){
car = c;
carId = c.getId();
}

but i think this is redundant, isn´t ?
now i am very confused on dealing with OJB...

a short, and last question,
why doesn´t OJB1.0.rc5 not deal with anonymous-keys
i thought its a nice feature!

greetings ralf


 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi,
> 
> Ralf Bode wrote:
> > Hi Armin,
> > thanks for your patience, first!
> > but the things with declaring PK_Fields
> > i read at:
> >
>
http://db.apache.org/ojb/howto-use-anonymous-keys.html
> > i did everything like told me :-)
> > the document is written nice and understandful,
> 
> doh! Assume the current implementation doesn't
> achieve this. All 
> anonymous keys are held in an internal map using the
> object itself as 
> key. Reading will be successful, but when the object
> e.g. will be 
> serialized and then returned to OJB the anonymous PK
> field will never be 
> found (object does not match a key), its only
> possible to extract the FK 
> from the associated reference object.
> Thus I think anonymous keys will only work in
> conjunction with 1:1 
> references.
> I don't write the 'anonymous-key' stuff, so maybe I
> overlooked an 
> important argument.
> 
> regards,
> Armin
> 
> 
> > but only the little thing 
> > froeign-key is null in my case...
> > 
> > did you know if this sample is available?
> > i didn´t found it in src-distribution.
> > 
> > thanks alot!
> > 
> >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi
> > Ralf,
> > 
> >> > but in my case the own id´s
> >> > of a class where anonymous too,
> >> > is that the matter?
> >>
> >>AFAIK we don't have a test case that mix this
> stuff.
> >>Think it is not allowed to declare a PK field
> >>anonymous.
> >>Recommend you to setup a test case similar to the
> >>examples in test suite 
> >>or docu
> >>(http://db.apache.org/ojb/tutorial3.html#Mapping
> 1:1
> >>
> >>associations). As recently as your test pass start
> >>to tweak ;-)
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>Ralf Bode wrote:
> >>
> >>>Hi Armin, again...
> >>>...sorry...
> >>>
> >>>i looked in samples you told me!
> >>>(thanks for tipps!)
> >>>but i have all so like
> >>>1:1-relationship
> >>>org.apache.ojb.broker.ObjectRepository$Group
> >>>org.apache.ojb.broker.ObjectRepository$Componente
> >>>(access="anonymous" for reffered ids)
> >>>but in my case the own id´s
> >>>of a class where anonymous too,
> >>>is that the matter?
> >>>but i don´t think so, because
> >>>for car and customer a id is "generated".
> >>>
> >>>But only!!! the reffered id 
> >>>(in customer for car is "null")
> >>>
> >>>...strangely... isn´t it ?
> >>>
> >>>perhaps i can send it to list / to you?
> >>>(i asked, because i will not blow up list
> >>>  with my (i think) foolishness)
> >>>
> >>>thanks for your patience!
> >>>ralf
> >>> --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> >>
> >>Hi
> >>
> >>>Ralf,
> >>>
> >>>
> Ralf Bode wrote:
> 
> 
> >hi ... again :-(
> >
> >it is really frustratingly...
> >i turned OTM->true
> >made:
> >customer.setCar(car)
> >broker.store(customer);
> >
> 
> I don't know what's wrong with your test, but
> this
> will definitely work 
> with the PB-api.
> You can find many examples in test suite, e.g. 
> ...broker.AnonymousFieldsTest.
> 
> regards,
> Armin
> 
> 
> 
> >but same...
> >customer is in DB, car not!
> >:-(
> >
> >i have read in aritcle in german-javamag
> >on OJB there was said "all is nice"
> >
> >or am i to stuid?
> >
> >i though it would be possible
> >to store "customer" and his car...
> >has anyone a "runnig"-case for an idot, like
> me?
> >
> >thanks!
> >
> >
> >
> >
> >--- Brian McCallister
> ><[EMAIL PROTECTED]> schrieb: >
> 
> Objects
> 
> 
> >are not automatically stored by reachability
> >
> >
> >
> >>-- the car isn't 
> >>inserted because it is attached to Customer.
> >>
> >>This
> >>
> >>*can* actually be 
> >>done in the OTM if Car is a truly dependent
> >>
> >>object
> >>
> >>(otm-dependent 
> >>attribute), but in the PB an object must be
> made
> >>explicitly persistent.
> >>
> >>broker.store(ca);
> >>broker.store(cu);
> >>
> >>-Brian
> >>
> >>On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:
> >>
> >>
> >>
> >>
> >>>Hi Brian,
> >>>now i got an "anonym" id
> >>>(very nice, so i now have "pure" javaBeans
> >>>no technicals in it :-)
> >>>
> >>>i made
> >>>cu = new Custiomer();
> >>>ca = new Car();
> >>>cu.setCar(ca);
> >>>broker.store(cu);
> >>>
> >>>now only a customer was in DB
> >>>
> >>>i must add the "auto-*" in descriptor:
> >>> >>>

Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi,

Ralf Bode wrote:
Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:
http://db.apache.org/ojb/howto-use-anonymous-keys.html
i did everything like told me :-)
the document is written nice and understandful,
doh! Assume the current implementation doesn't achieve this. All 
anonymous keys are held in an internal map using the object itself as 
key. Reading will be successful, but when the object e.g. will be 
serialized and then returned to OJB the anonymous PK field will never be 
found (object does not match a key), its only possible to extract the FK 
from the associated reference object.
Thus I think anonymous keys will only work in conjunction with 1:1 
references.
I don't write the 'anonymous-key' stuff, so maybe I overlooked an 
important argument.

regards,
Armin

but only the little thing 
froeign-key is null in my case...

did you know if this sample is available?
i didn´t found it in src-distribution.
thanks alot!

 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
> but in my case the own id´s
> of a class where anonymous too,
> is that the matter?
AFAIK we don't have a test case that mix this stuff.
Think it is not allowed to declare a PK field
anonymous.
Recommend you to setup a test case similar to the
examples in test suite 
or docu
(http://db.apache.org/ojb/tutorial3.html#Mapping 1:1

associations). As recently as your test pass start
to tweak ;-)
regards,
Armin
Ralf Bode wrote:

Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id 
(in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
 with my (i think) foolishness)
thanks for your patience!
ralf
--- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
Hi

Ralf,


Ralf Bode wrote:


hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but this
will definitely work 
with the PB-api.
You can find many examples in test suite, e.g. 
...broker.AnonymousFieldsTest.

regards,
Armin


but same...
customer is in DB, car not!
:-(
i have read in aritcle in german-javamag
on OJB there was said "all is nice"
or am i to stuid?

i though it would be possible
to store "customer" and his car...
has anyone a "runnig"-case for an idot, like me?
thanks!



--- Brian McCallister
<[EMAIL PROTECTED]> schrieb: >
Objects


are not automatically stored by reachability



-- the car isn't 
inserted because it is attached to Customer.
This

*can* actually be 
done in the OTM if Car is a truly dependent
object

(otm-dependent 
attribute), but in the PB an object must be made
explicitly persistent.

broker.store(ca);
broker.store(cu);
-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:




Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)
i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);
now only a customer was in DB

i must add the "auto-*" in descriptor:



now i have a car and a customer,
but custumer.carId is "null" in database...
of course carId is anonym too! ...
any idea? or am i to silly
and i must do pure sql ... as a penalty... ?
:-)

in table customer is:
CREATE TABLE CUSTOMER
(
 ID INT PRIMARY KEY AUTO_INCREMENT,
 CARID INT,
 FOREIGN KEY (CARID) REFERENCES CAR(ID)
);
thanks!

--- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
Thanks



Brian,



but do you mean with "anonymous" keys ?

now i have (in classes):
CUSTOMER
car: Car
carId: int
CAR:
id: int
(and the XML desc for it like in mail before)
am i with anon.keys able to "see" car-fk in
database-table CUSTOMER?
after:
broker.store(customer); ?
thanks again, and thanks for your patience.
greetings!





On the FK thing, if you do not use anonymous
FK's



the ID's need to be
managed manually, as well as the references.
I

=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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: Installation of OJB

2004-02-03 Thread Ralf Bode
Hi Armin,
thanks for your patience, first!
but the things with declaring PK_Fields
i read at:
http://db.apache.org/ojb/howto-use-anonymous-keys.html
i did everything like told me :-)
the document is written nice and understandful,
but only the little thing 
froeign-key is null in my case...

did you know if this sample is available?
i didn´t found it in src-distribution.

thanks alot!

 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
> 
>  > but in my case the own id´s
>  > of a class where anonymous too,
>  > is that the matter?
> 
> AFAIK we don't have a test case that mix this stuff.
> Think it is not allowed to declare a PK field
> anonymous.
> Recommend you to setup a test case similar to the
> examples in test suite 
> or docu
> (http://db.apache.org/ojb/tutorial3.html#Mapping 1:1
> 
> associations). As recently as your test pass start
> to tweak ;-)
> 
> regards,
> Armin
> 
> 
> Ralf Bode wrote:
> > Hi Armin, again...
> > ...sorry...
> > 
> > i looked in samples you told me!
> > (thanks for tipps!)
> > but i have all so like
> > 1:1-relationship
> > org.apache.ojb.broker.ObjectRepository$Group
> > org.apache.ojb.broker.ObjectRepository$Componente
> > (access="anonymous" for reffered ids)
> > but in my case the own id´s
> > of a class where anonymous too,
> > is that the matter?
> > but i don´t think so, because
> > for car and customer a id is "generated".
> > 
> > But only!!! the reffered id 
> > (in customer for car is "null")
> > 
> > ...strangely... isn´t it ?
> > 
> > perhaps i can send it to list / to you?
> > (i asked, because i will not blow up list
> >   with my (i think) foolishness)
> > 
> > thanks for your patience!
> > ralf
> >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> Hi
> > Ralf,
> > 
> >>Ralf Bode wrote:
> >>
> >>>hi ... again :-(
> >>>
> >>>it is really frustratingly...
> >>>i turned OTM->true
> >>>made:
> >>>customer.setCar(car)
> >>>broker.store(customer);
> >>>
> >>
> >>I don't know what's wrong with your test, but this
> >>will definitely work 
> >>with the PB-api.
> >>You can find many examples in test suite, e.g. 
> >>...broker.AnonymousFieldsTest.
> >>
> >>regards,
> >>Armin
> >>
> >>
> >>>but same...
> >>>customer is in DB, car not!
> >>>:-(
> >>>
> >>>i have read in aritcle in german-javamag
> >>>on OJB there was said "all is nice"
> >>>
> >>>or am i to stuid?
> >>>
> >>>i though it would be possible
> >>>to store "customer" and his car...
> >>>has anyone a "runnig"-case for an idot, like me?
> >>>
> >>>thanks!
> >>>
> >>>
> >>>
> >>>
> >>> --- Brian McCallister
> >>><[EMAIL PROTECTED]> schrieb: >
> >>
> >>Objects
> >>
> >>>are not automatically stored by reachability
> >>>
> >>>
> -- the car isn't 
> inserted because it is attached to Customer.
> This
> *can* actually be 
> done in the OTM if Car is a truly dependent
> object
> (otm-dependent 
> attribute), but in the PB an object must be made
> explicitly persistent.
> 
> broker.store(ca);
> broker.store(cu);
> 
> -Brian
> 
> On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:
> 
> 
> 
> >Hi Brian,
> >now i got an "anonym" id
> >(very nice, so i now have "pure" javaBeans
> >no technicals in it :-)
> >
> >i made
> >cu = new Custiomer();
> >ca = new Car();
> >cu.setCar(ca);
> >broker.store(cu);
> >
> >now only a customer was in DB
> >
> >i must add the "auto-*" in descriptor:
> > > name="car"
> > class-ref="de.ralle.Car"
> > auto-retrive="true"
> > auto-update="true"
> > auto-delete="true">
> >
> >
> >
> >now i have a car and a customer,
> >but custumer.carId is "null" in database...
> >of course carId is anonym too! ...
> >
> >any idea? or am i to silly
> >and i must do pure sql ... as a penalty... ?
> :-)
> >
> >
> >in table customer is:
> >CREATE TABLE CUSTOMER
> >(
> >   ID INT PRIMARY KEY AUTO_INCREMENT,
> >   CARID INT,
> >   FOREIGN KEY (CARID) REFERENCES CAR(ID)
> >);
> >
> >thanks!
> >
> >--- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
> 
> Thanks
> 
> 
> >Brian,
> >
> >
> >>but do you mean with "anonymous" keys ?
> >>
> >>now i have (in classes):
> >>CUSTOMER
> >>car: Car
> >>carId: int
> >>
> >>CAR:
> >>id: int
> >>
> >>(and the XML desc for it like in mail before)
> >>am i with anon.keys able to "see" car-fk in
> >>database-table CUSTOMER?
> >>after:
> >>broker.store(customer); ?
> >>
> >>thanks again, and thanks for your patience.
> >>greetings!
> >>
> >>
> >>
> >>
> >>
> >>>On the FK thing, if you do not use anonymous
> 
> FK's
> 
> 
> >>>the ID's need to be
> >>>managed manually, as well as the references.
> I
> >>
> 
=== message truncated === 


Re: Installation of OJB

2004-02-03 Thread Armin Waibel
Hi Ralf,

> but in my case the own id´s
> of a class where anonymous too,
> is that the matter?
AFAIK we don't have a test case that mix this stuff.
Think it is not allowed to declare a PK field anonymous.
Recommend you to setup a test case similar to the examples in test suite 
or docu (http://db.apache.org/ojb/tutorial3.html#Mapping 1:1 
associations). As recently as your test pass start to tweak ;-)

regards,
Armin
Ralf Bode wrote:
Hi Armin, again...
...sorry...
i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".
But only!!! the reffered id 
(in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
  with my (i think) foolishness)
thanks for your patience!
ralf
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
Ralf Bode wrote:

hi ... again :-(

it is really frustratingly...
i turned OTM->true
made:
customer.setCar(car)
broker.store(customer);
I don't know what's wrong with your test, but this
will definitely work 
with the PB-api.
You can find many examples in test suite, e.g. 
...broker.AnonymousFieldsTest.

regards,
Armin

but same...
customer is in DB, car not!
:-(
i have read in aritcle in german-javamag
on OJB there was said "all is nice"
or am i to stuid?

i though it would be possible
to store "customer" and his car...
has anyone a "runnig"-case for an idot, like me?
thanks!



--- Brian McCallister
<[EMAIL PROTECTED]> schrieb: >
Objects

are not automatically stored by reachability


-- the car isn't 
inserted because it is attached to Customer. This
*can* actually be 
done in the OTM if Car is a truly dependent object
(otm-dependent 
attribute), but in the PB an object must be made
explicitly persistent.

broker.store(ca);
broker.store(cu);
-Brian

On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:



Hi Brian,
now i got an "anonym" id
(very nice, so i now have "pure" javaBeans
no technicals in it :-)
i made
cu = new Custiomer();
ca = new Car();
cu.setCar(ca);
broker.store(cu);
now only a customer was in DB

i must add the "auto-*" in descriptor:



now i have a car and a customer,
but custumer.carId is "null" in database...
of course carId is anonym too! ...
any idea? or am i to silly
and i must do pure sql ... as a penalty... ? :-)
in table customer is:
CREATE TABLE CUSTOMER
(
  ID INT PRIMARY KEY AUTO_INCREMENT,
  CARID INT,
  FOREIGN KEY (CARID) REFERENCES CAR(ID)
);
thanks!

--- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
Thanks


Brian,


but do you mean with "anonymous" keys ?

now i have (in classes):
CUSTOMER
car: Car
carId: int
CAR:
id: int
(and the XML desc for it like in mail before)
am i with anon.keys able to "see" car-fk in
database-table CUSTOMER?
after:
broker.store(customer); ?
thanks again, and thanks for your patience.
greetings!




On the FK thing, if you do not use anonymous
FK's


the ID's need to be
managed manually, as well as the references. I
tend


to recommend using
anonymous keys for FK relationships because it
is


very easy to forget
this.
-Brian





-

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


__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles:
http://suche.yahoo.de


-

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


__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles:
http://suche.yahoo.de


-

To unsubscribe, e-mail:
[EMAIL PROTECTED]


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


=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de
-
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 updating objects with collections

2004-02-03 Thread Guillaume Nodet
I found a workaround, but i will decrease performance dramatically.
Instead of doing a
broker.store(a);
I do the following:
Identity id = new Identity(a, broker);
A oldA = broker.getObjectByIdentity(id);
broker.delete(oldA);
broker.store(a);

If i usie only the store call (which leads to data inconsistency) the sql
statements executed are
the following ones:
update a ...// update object a
insert into b ...   // store b collection, without removing old 
ones...
When using the workaround, the following statements are executed:
delete from b ...   // delete collection of B
delete from a   // delete object A
select ... from a   // the object is not in cache anymore, so 
materialize it
insert into a ...   // insert a
select ... from b   // check materializing b
insert into b ...   // insert into b

Which is not optimal at all.
I'd like to have the following statement:
delete from b ...   // remove old collection of b
update a ...// update object a
insert into b ...   // insert new collection

Can anyone give me a hint the problem ?

-Message d'origine-
De : Guillaume Nodet [mailto:[EMAIL PROTECTED]
Envoye : mardi 3 fevrier 2004 10:12
A : OJB Users List
Objet : Problem updating objects with collections



Here is my problem:
  I've got an object of class A with a collection of objects of class B.
  I receive fresh new objects to update from a source that is not ojb.
  When i want to update the object of class A the following operations
  are performed (let say i have only one B object in the collection):
* update of row in the A table
* insert a row in the B table
  My problem is that ojb do not delete the old B collection.

I checked the PersistenceBrokerImpl code, but i did not see anything
about deleting objects in collections that are not here anymore.

Regards

Guillaume Nodet


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



Problem updating objects with collections

2004-02-03 Thread Guillaume Nodet

Here is my problem:
  I've got an object of class A with a collection of objects of class B.
  I receive fresh new objects to update from a source that is not ojb.
  When i want to update the object of class A the following operations 
  are performed (let say i have only one B object in the collection):
* update of row in the A table
* insert a row in the B table
  My problem is that ojb do not delete the old B collection.

I checked the PersistenceBrokerImpl code, but i did not see anything
about deleting objects in collections that are not here anymore.

Regards

Guillaume Nodet


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



Re: Installation of OJB

2004-02-03 Thread Ralf Bode
Hi Armin, again...
...sorry...

i looked in samples you told me!
(thanks for tipps!)
but i have all so like
1:1-relationship
org.apache.ojb.broker.ObjectRepository$Group
org.apache.ojb.broker.ObjectRepository$Componente
(access="anonymous" for reffered ids)
but in my case the own id´s
of a class where anonymous too,
is that the matter?
but i don´t think so, because
for car and customer a id is "generated".

But only!!! the reffered id 
(in customer for car is "null")

...strangely... isn´t it ?

perhaps i can send it to list / to you?
(i asked, because i will not blow up list
  with my (i think) foolishness)

thanks for your patience!
ralf
 --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
Ralf,
> 
> Ralf Bode wrote:
> > hi ... again :-(
> > 
> > it is really frustratingly...
> > i turned OTM->true
> > made:
> > customer.setCar(car)
> > broker.store(customer);
> > 
> 
> I don't know what's wrong with your test, but this
> will definitely work 
> with the PB-api.
> You can find many examples in test suite, e.g. 
> ...broker.AnonymousFieldsTest.
> 
> regards,
> Armin
> 
> > but same...
> > customer is in DB, car not!
> > :-(
> > 
> > i have read in aritcle in german-javamag
> > on OJB there was said "all is nice"
> > 
> > or am i to stuid?
> > 
> > i though it would be possible
> > to store "customer" and his car...
> > has anyone a "runnig"-case for an idot, like me?
> > 
> > thanks!
> > 
> > 
> > 
> > 
> >  --- Brian McCallister
> > <[EMAIL PROTECTED]> schrieb: >
> Objects
> > are not automatically stored by reachability
> > 
> >>-- the car isn't 
> >>inserted because it is attached to Customer. This
> >>*can* actually be 
> >>done in the OTM if Car is a truly dependent object
> >>(otm-dependent 
> >>attribute), but in the PB an object must be made
> >>explicitly persistent.
> >>
> >>broker.store(ca);
> >>broker.store(cu);
> >>
> >>-Brian
> >>
> >>On Feb 2, 2004, at 3:13 PM, Ralf Bode wrote:
> >>
> >>
> >>>Hi Brian,
> >>>now i got an "anonym" id
> >>>(very nice, so i now have "pure" javaBeans
> >>>no technicals in it :-)
> >>>
> >>>i made
> >>>cu = new Custiomer();
> >>>ca = new Car();
> >>>cu.setCar(ca);
> >>>broker.store(cu);
> >>>
> >>>now only a customer was in DB
> >>>
> >>>i must add the "auto-*" in descriptor:
> >>> >>>  name="car"
> >>>  class-ref="de.ralle.Car"
> >>>  auto-retrive="true"
> >>>  auto-update="true"
> >>>  auto-delete="true">
> >>> 
> >>>
> >>>
> >>>now i have a car and a customer,
> >>>but custumer.carId is "null" in database...
> >>>of course carId is anonym too! ...
> >>>
> >>>any idea? or am i to silly
> >>>and i must do pure sql ... as a penalty... ? :-)
> >>>
> >>>
> >>>in table customer is:
> >>>CREATE TABLE CUSTOMER
> >>>(
> >>>ID INT PRIMARY KEY AUTO_INCREMENT,
> >>>CARID INT,
> >>>FOREIGN KEY (CARID) REFERENCES CAR(ID)
> >>>);
> >>>
> >>>thanks!
> >>>
> >>> --- Ralf Bode <[EMAIL PROTECTED]> schrieb: >
> >>
> >>Thanks
> >>
> >>>Brian,
> >>>
> but do you mean with "anonymous" keys ?
> 
> now i have (in classes):
> CUSTOMER
> car: Car
> carId: int
> 
> CAR:
> id: int
> 
> (and the XML desc for it like in mail before)
> am i with anon.keys able to "see" car-fk in
> database-table CUSTOMER?
> after:
> broker.store(customer); ?
> 
> thanks again, and thanks for your patience.
> greetings!
> 
> 
> 
> 
> >On the FK thing, if you do not use anonymous
> >>
> >>FK's
> >>
> >the ID's need to be
> >managed manually, as well as the references. I
> 
> tend
> 
> >to recommend using
> >anonymous keys for FK relationships because it
> >>
> >>is
> >>
> >very easy to forget
> >this.
> >
> >-Brian
> >
> >
> >
> >
> 
> >
>
-
> > 
> >To unsubscribe, e-mail:
> >[EMAIL PROTECTED]
> >For additional commands, e-mail:
> >[EMAIL PROTECTED]
> >
> 
> 
> >
>
__
> > 
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Mit Yahoo! Suche finden Sie alles:
> http://suche.yahoo.de
> 
> 
> >>>
> >
>
-
> > 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> >>>
> >>>
> >
>
__
> > 
> >>>Gesendet von Yahoo! Mail - http://mail.yahoo.de
> >>>Mit Yahoo! Suche finden Sie alles:
> >>
> >>http://suche.yahoo.de
> >>
> >>>
> >
>
-
> > 
> >>>To unsubscribe, e-mail:
> >>
> >>[EMAIL PROTECTED]
> >>
> >>>For additional commands, e-mail:
> >>
> >>[EMAIL PROTECTED]
> >>
> 
=== message truncated === 

__

Gesendet von Yahoo! Mail - http://mail

Re: ojb with Sybase

2004-02-03 Thread Danilo Tommasina
Hi,

we are successfully using Sybase with PersistenceBroker (no ODMG) 
however this shouldn't be a problem.

depending on your Sybase version you should try to use 
platform="SybaseASE" instead of "Sybase" in your connection descriptor.

this solved our problems (we also were using platform="Sybase" at the 
beginning)

bye
danilo

Hi, I tried to use ojb with Sybase, it did not work.

but the same code worked fine with mysql and sql server.

I wanted to do an easy retrieve  from the Sybase,I met an Exception that 
is "[org.apache.ojb.odmg.collections.DListImpl] ERROR: Generation of new 
id failed
ConnectionManager is NOT in transaction" .

Here is my code,xml and Exception , anyone can give me some clue to 
solve this problem which puzzle me two days.
CODE:
public static List retrieveBook(String bookName){
   Implementation impl = OJB.getInstance();
   Database db=impl.newDatabase();
   try {
   db.open("webpublishSybase",db.OPEN_READ_ONLY);
   } catch (ODMGException e) {
   e.printStackTrace();  //To change body of catch statement use 
Options | File Templates.
   }
   List list=null;
Transaction tx = impl.newTransaction();
   try{



   tx.begin();
   OQLQuery query = impl.newOQLQuery();
   query.create("select results from "+Book.class.getName()+" 
where bookName like $1 ");
   query.bind(bookName);
   DList results = (DList) query.execute();
   tx.commit();
   list=results;

   }catch(Exception e){
e.printStackTrace();
   tx.abort();
   }finally{
   try {
   db.close();
   } catch (ODMGException e) {
   e.printStackTrace();  //To change body of catch statement 
use Options | File Templates.
   }
   }



   return list;
   }
   REPOSITORY_DATABASE.XML

  jcd-alias="webpublishMysql"
  default-connection="false"
  platform="MySQL"
  jdbc-level="3.0"
   useAutoCommit="2"
  driver="org.gjt.mm.mysql.Driver"
  protocol="jdbc"
  subprotocol="mysql"
  
dbalias="//192.168.0.203/webpublish?seUnicode=true&characterEncoding=gb2312" 

  username="sa"
  password="nihao123"
   
   />
   
   
   >

   />

   

  Exception:
[org.apache.ojb.odmg.collections.DListImpl] ERROR: Generation of new 
id failed
ConnectionManager is NOT in transaction
org.apache.ojb.broker.TransactionNotInProgressException: 
ConnectionManager is NOT in transaction
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown 
Source)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown 
ource)
at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown 
Source)
at 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(Unknown 
Source)
at 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(Unknown 
Source)
at 
org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(Unknown 
Source)
at org.apache.ojb.odmg.collections.DListImpl.generateNewId(Unknown 
Source)
at org.apache.ojb.odmg.collections.DListImpl.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 

at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 

at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
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 org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source)
at 
com.scholarbook.webpublish.Persist.ojb.Retrieve.retrieveBook(Retrieve.java:62) 

at com.scholarbook.webpublish.Persist.ojb.Test.main(Test.java:28)
org.apache.ojb.broker.PersistenceBrokerException: 
org.apache.ojb.broker.PersistenceBrokerException: 
org.apache.ojb.broker.TransactionNotInProgressException: 
ConnectionManager is NOT in transaction
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.DelegatingPe