RE: ReferenceDescriptor

2004-08-06 Thread Claudio Romano
Thanx,

this is what i currenty doing, i just hopped for 
reference-descriptor in product solution. So i
could get easier the products specials in my
product, as i now that there is only one special
per product.

Claudio


> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 06, 2004 10:58 AM
> To: OJB Users List
> Subject: Re: ReferenceDescriptor
> 
> 
> Claudio Romano wrote:
> > If i have a Product associated 1:1 with an Special and it 
> is modeled in the
> > db such that the special table has a product_id (not 
> primarykey!)... is
> > there a way to map the Special with a ReferenceDescriptor 
> in to the Product?
> >
> 
> well this sounds as Product has a 1:n relation with Special, because 
> Special has an Product FK (product_id) and the Special has an 1:1 
> relation to Product. The FK 'product_id' have to represent the PK of 
> Product.
> So you can declare a collection-descriptor in Product and an 
> reference-descriptor in Special.
> 
> regards,
> Armin
> 
> > thx
> > Claudio
> > 
> > 
> > 
> -
> > 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]



ReferenceDescriptor

2004-08-04 Thread Claudio Romano

If i have a Product associated 1:1 with an Special and it is modeled in the
db such that the special table has a product_id (not primarykey!)... is
there a way to map the Special with a ReferenceDescriptor in to the Product?

thx
Claudio


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



M:N Mappings -> OJB_BRANCH_1_0

2004-01-26 Thread Claudio Romano
Hi All,

i just updated to OJB_BRANCH_1_0. Now i have some Problems
with M:N mappings. 
(The categories_description has two primarkeys!!)

I always get an exception when i try to get the CategoriesDesctiption
from the Product.



My Class-Descriptors:



   
   
  
  
   




   
   



   
   





The Exception

java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.associateBatc
hed(MtoNCollectionPrefetcher.java:392)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelat
ionship(MtoNCollectionPrefetcher.java:126)
at
org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.pr
efetch(QueryReferenceBroker.java:837)
at
org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListene
r.beforeLoading(QueryReferenceBroker.java:894)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.beforeLoading(Collecti
onProxy.java:173)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProx
y.java:400)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.iterator(CollectionPro
xy.java:230)
at Products.getCategoriesName(Products.java:198)


I something wrong with my mapping? 

thanks in advance 
Claudio Romano

www.lindos.ch
yourshopadmin.sourceforge.net

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



RE: SequenceManagerMySQLImpl

2004-01-07 Thread Claudio Romano
Hi Thomas,

thanks for the quick anwer! The tables that throws this
exceptions don't have any autoincrement field on the
database! So i can't declare this attribute?!

Or am i missing something?

Thanks
Claudio Romano


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 11:47 AM
To: OJB Users List
Subject: Re: SequenceManagerMySQLImpl


Hi Claudio,

To work with sequence numbering you have to declare the respective 
attribute as autoincrement="true".
If you don't do this you can not expect the sequence manager to work for

those tables!

Thomas

Claudio Romano wrote:
> Hi all,
> 
> i updated OJB from the rc3 to rc5. Now i have a problem with tables
> without an
> auto increment field. The Method "afterStore" in the
> SequenceManagerMySQLImpl
> class alway throws ArrayIndexOutOfBoundsException on these tables.
> 
> Am i doing something wrong?
> 
> This change causes my exception:
> 
> diff -u -r1.14 -r1.15 
> public void afterStore(JdbcAccess dbAccess, ClassDescriptor cld,
Object
> obj) 
>  throws SequenceManagerException
>  {
>  
> -FieldDescriptor fd = cld.getAutoIncrementField();
> +    FieldDescriptor fd = cld.getAutoIncrementFields()[0];
> 
> 
> 
> Thanks
> Claudio Romano
> 
> -
> 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]



SequenceManagerMySQLImpl

2004-01-07 Thread Claudio Romano

Hi all,

i updated OJB from the rc3 to rc5. Now i have a problem with tables
without an
auto increment field. The Method "afterStore" in the
SequenceManagerMySQLImpl
class alway throws ArrayIndexOutOfBoundsException on these tables.

Am i doing something wrong?

This change causes my exception:

diff -u -r1.14 -r1.15 
public void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object
obj) 
 throws SequenceManagerException
 {
 
-FieldDescriptor fd = cld.getAutoIncrementField();
+FieldDescriptor fd = cld.getAutoIncrementFields()[0];



Thanks
Claudio Romano

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



Sequence Manager

2003-09-17 Thread Claudio Romano
Hello ALL,

i have a little question concerning OJB + MySQL + MySQLSequenceManager:

How can i get the last inserted primarykey of a table?

thank
Claudio Romano

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



RE: Update and Save Problem

2003-03-21 Thread Claudio Romano
>i have a problem to update and/or save my class to the database. The 
>repository and the class seems to be ok. But everytime i save or update

>my Class i become the following error:
>
>"Cannot convert class java.lang.Integer to SQL type requested due to 
>java.lang.ArrayIndexOutOfBoundsException - 2"
>
>can someone tell me when or why this happens?? or what im
>doing wrong?


Hi

I use ojb 0.9.9, mySQL database, jdk 1.4.1_01
on win 2000.

My Class Members are:

[java]

public class Products {
protected int id;
protected int quantity;
protected String model;
protected String image;
protected double price;
protected Date dateAdded;
protected Date lastModified;
protected Date dateAvailable;
protected double weight;
protected int status;
protected int taxClassId;
protected int manufacturersId;
protected int productsOrdered;

protected Manufacturers manufacturers;
protected ProductsSpecials productsSpecials;
protected Collection productsDescription;

protected Collection categoriesDesc;
[/java]

[repository]



























  








  









[/repository]


My Class ( Products) seems to filled up correctly in my Application. 
Then i store the Object like this:



[java]
br = PersistenceBrokerFactory.defaultPersistenceBroker();
br.beginTransaction();
br.store( toSaveObject);
br.commitTransaction();
[/java]

after that i become this exception:

[EXCEPTION]
java.sql.SQLException: Cannot convert class java.lang.Integer to SQL
type 
requested due to java.lang.ArrayIndexOutOfBoundsException - 2
at
com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:861)
at
com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:881)
at
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatemen
t(Unknown Source)
[/EXCEPTION]


-Original Message-
From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 21, 2003 5:28 PM
To: OJB Users List
Subject: Re: Update and Save Problem


hi claudio,

a little bit more information could be useful.

jakob

Claudio Romano wrote:


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



Update and Save Problem

2003-03-21 Thread Claudio Romano
Hi

i have a problem to update and/or save my class to the database.
The repository and the class seems to be ok.
But everytime i save or update my Class i become
the following error:

"Cannot convert class java.lang.Integer to SQL type requested due to
java.lang.ArrayIndexOutOfBoundsException - 2"

can someone tell me when this happens?? or what im 
doing wrong?

thanks
Claudio Romano


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