RE: Methods of calling stored procedures in OJB

2006-08-09 Thread Ron Gallagher
Jim --

Your assumptions are absolutely correct.

Ron Gallagher
 
 From: Wright, Jim \(NIH/CIT\) [C] [EMAIL PROTECTED]
 Date: 2006/08/09 Wed AM 11:09:41 EDT
 To: OJB Users List ojb-user@db.apache.org
 Subject: RE: Methods of calling stored procedures in OJB
 
 Ron,
 
 My doubt was how was the stored procedure being called?  I was thinking
 that you had to actually call it in your java code.  However, I think
 what you and the documentation are implicitly saying is that the broker
 is actually calling the stored procedure as you have configured it in
 the repository.  Therefore there is no need to call the stored procedure
 in one's java code.  When I pass an object defined to use a stored
 procedure to the OJB store instruction the s.p. will be executed.  Does
 this sound correct?  
 
 Thanks,
 
 Jim Wright 
 
 
 -Original Message-
 From: Ron Gallagher [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, August 08, 2006 8:44 PM
 To: OJB Users List
 Subject: Re: Methods of calling stored procedures in OJB
 
 Jim --
 
 OJB supports the use of stored procedures to handle all persistence
 operations (insert, update and delete).  The stored procedures that are
 configured in the repository are used in place of standard insert,
 update and delete SQL commands.  You do not need to use any sort of
 database triggers in order to take advantage of OJB's use of stored
 procedures for persistence operations.
 
 The example that you refer in the documentation to was culled from an
 application that I was one of the lead architects on.  In the
 environment that that application was to be deployed in, the DBAs
 insisted that all persistence operations be performed by stored
 procedures.  This was accomplished by utilizing OJB's support for stored
 procedures.  In that same environment, the business community insisted
 that we track who created and performed the last update on each record.
 That requirement was accomplished via the insert/update triggers that
 are referenced in the sample.  The final feature was the requirement
 that any updates to the four audit columns be reflected in the java
 objects that were managed by the application.  This requirement was
 accomplished in two steps: (1) the stored procedures that OJB utilized
 returned these values to the caller (i.e. OJB) via the RETURNING
 clause and (2) the configuration of the stored procedure in the
 repository file included the attri
  bute 'return=true' attribute on any arguments that were returned to
 OJB.
 
 I hope this helps you out.
 
 Let me know if I can clarify things any further.
 
 Ron Gallagher
 
  
  From: Wright, Jim \(NIH/CIT\) [C] [EMAIL PROTECTED]
  Date: 2006/08/08 Tue PM 04:57:32 EDT
  To: ojb-user@db.apache.org
  Subject: Methods of calling stored procedures in OJB
  
  Does one have to use database triggers in order to run stored
 procedures
  in OJB?  The Apache documentation seems to imply that:
  
   
  
 
 http://db.apache.org/ojb/docu/howtos/howto-work-with-stored-procedures.h
  tml#A+simple+example
  
   
  
  I need a way to run them that does not involve triggers.
  
  Jim Wright 
  
   
  
  
  
 
 
 -
 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: Methods of calling stored procedures in OJB

2006-08-08 Thread Ron Gallagher
Jim --

OJB supports the use of stored procedures to handle all persistence operations 
(insert, update and delete).  The stored procedures that are configured in the 
repository are used in place of standard insert, update and delete SQL 
commands.  You do not need to use any sort of database triggers in order to 
take advantage of OJB's use of stored procedures for persistence operations.

The example that you refer in the documentation to was culled from an 
application that I was one of the lead architects on.  In the environment that 
that application was to be deployed in, the DBAs insisted that all persistence 
operations be performed by stored procedures.  This was accomplished by 
utilizing OJB's support for stored procedures.  In that same environment, the 
business community insisted that we track who created and performed the last 
update on each record.  That requirement was accomplished via the insert/update 
triggers that are referenced in the sample.  The final feature was the 
requirement that any updates to the four audit columns be reflected in the java 
objects that were managed by the application.  This requirement was 
accomplished in two steps: (1) the stored procedures that OJB utilized returned 
these values to the caller (i.e. OJB) via the RETURNING clause and (2) the 
configuration of the stored procedure in the repository file included the attri
 bute 'return=true' attribute on any arguments that were returned to OJB.

I hope this helps you out.

Let me know if I can clarify things any further.

Ron Gallagher

 
 From: Wright, Jim \(NIH/CIT\) [C] [EMAIL PROTECTED]
 Date: 2006/08/08 Tue PM 04:57:32 EDT
 To: ojb-user@db.apache.org
 Subject: Methods of calling stored procedures in OJB
 
 Does one have to use database triggers in order to run stored procedures
 in OJB?  The Apache documentation seems to imply that:
 
  
 
 http://db.apache.org/ojb/docu/howtos/howto-work-with-stored-procedures.h
 tml#A+simple+example
 
  
 
 I need a way to run them that does not involve triggers.
 
 Jim Wright 
 
  
 
 
 


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



RE: Using OJB with Oracle Packages and Procedures - simple Question

2005-10-26 Thread Ron Gallagher
Fernando --

OJB can be configured to use Oracle packages/procedures for all CRUD
operations.  See
http://db.apache.org/ojb/docu/howtos/howto-work-with-stored-procedures.html
for details on how.  As far as using packages/procedures for queries, I
don't think support for that is present, or even planned for.

Ron Gallagher

-Original Message-
From: Fernando Bernardino [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 26, 2005 9:01 AM
To: ListaOJB
Subject: Using OJB with Oracle Packages and Procedures - simple Question

Hello people!

I'm creating a app for a mobile phone/PDA's/Palms. This app connect to a
servlet server and uses request/response to send/get the information. The
client is an AWT frame.

In the server, I'm using Struts to control my servlets and I'm thinking
about to use OJB to control my DAO's.

But I have to work with PKG's/PRC's from Oracle. Can I do that with OJB? Is
that recomended from you guys?

Thanks for your's attention. (Sorry my english..)


--
Fernando Bernardino

-
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: Sequence managers and insert triggers

2005-04-16 Thread Ron Gallagher
Mike --

Have you considered having OJB use a stored procedure to handle the insert
operations?  If you do so, you could have the stored procedure return to ojb
the 'auto-number' value that was assigned by the trigger.  This is what I
had to do on a prior project, and that effort lead to the introduction of
stored procedure support for insert, update and delete operations.  It's
been almost a year since I used Oracle in that manner, but I believe the
phrase that the SP would use to return the trigger-assigned auto-number to
it's 'caller' is RETURNING.  Check out
http://db.apache.org/ojb/docu/howtos/howto-work-with-stored-procedures.html,
and you'll see the examples that I posted when we implemented the SP support
for IUD operations.  The example referenced above acquires the next value
from a sequence, uses it in the insert operation and returns it to the
caller.  I believe you could do the same sort of thing with a value that's
assigned via the insert trigger.

Ron Gallagher
Atlanta, GA

-Original Message-
From: Mike Jackson [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 15, 2005 7:10 PM
To: 'OJB Users List'
Subject: RE: Sequence managers and insert triggers

That's basically how it works.  We have triggers which upon insert will
populate the autonumber fields.  The triggers didn't look to see if the
autonumber was already populated so if I had used the sequence based
implementation I'd have ended up incrementing the sequence twice and none of
my fk's would have the proper information in them.  This would probably
cause integrity constraint violations, but we've since changed the triggers
to detect if the autonumber is populated.  The dba isn't completely happy
with this solution (ojb gets the sequence numbers and populates, anything
else doesn't), but he's ok with it.  The normal route for records is to be
inserted for the master record with a stored procedure, but the child
tables are all direct inserts with triggers to take care of things.

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


 -Original Message-
 From: Armin Waibel [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 15, 2005 3:42 PM
 To: OJB Users List
 Subject: Re: Sequence managers and insert triggers
 
 
 Hi Mike,
 
 think I don't understand your problem (never used insert trigger), so 
 be patience. If you are using a insert trigger I assume the trigger 
 set the PK value on insert of new objects? Or do you using a stored 
 procedure to get the key or to insert the whole object?
 
 OJB supports database generated sequences. A sequence manager 
 supporting this kind of key generation can be found here:
 http://db.apache.org/ojb/docu/guides/sequencemanager.html#Data
 base+sequences+based+implementation
 
 The SequenceManagerNativeImpl supports database identity columns, 
 don't know if Oracle supports this (the exception indicate it 
 doesn't).
 
 regards,
 Armin
 
 Mike Jackson wrote:
  Actually I take it back, I was getting a -2, but when I got the 
  attributes on the identity column set properly I'm getting a
  java.lang.UnsupportedOperationException: This feature is not 
  supported by this implementation.  Perhaps this is the
 wrong sequence
  manager to use on oracle?
  
  --mikej
  -=-
  mike jackson
  [EMAIL PROTECTED]
  
  
  
 -Original Message-
 From: Mike Jackson [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 15, 2005 2:45 PM
 To: 'OJB Users List'
 Subject: Sequence managers and insert triggers
 
 
 I'm running on an Oracle database (8i) with insert triggers to 
 create artifical keys for my table records.  The howtos seemed to 
 indicate that SequenceManagerNativeImpl might be the proper sequence 
 manager to use but the keys are coming out goofy, so clearly I'm not 
 understanding or something.
 Which of the sequence managers should I be using?  I've got other 
 applications using the same database, so removing the triggers and 
 using the native sequences via OJB isn't an option at this time.
 
 --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]




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



RE: Intercepting updates and inserts

2004-06-02 Thread Ron Gallagher
Robert --

Check out these two interfaces:

org.apache.ojb.broker.PBLifeCycleListener
org.apache.ojb.broker.PBStateListener

The PBLifeCycleListener provides callbacks that reflect all object-level
operations (lookup, insert, update, delete).  This is probably what you'll
want to utilize.  The PBStateListener interface provides callbacks that
reflect PersistenceBroker-level operations (open, close, begin, commit,
rollback).

Both of the interfaces referenced above extend
org.apache.ojb.broker.PBListener.  So, if you've got an object that
implements one or both of these interfaces, you can use the
org.apache.ojb.broker.PersistenceBroker::addListener(PBListener) method to
register that object as a 'listener'.

On my last project, we made extensive use of these listener interfaces for
the same reasons you've described.  In our situation, we had our own
'factory' object that was used to serve up PersistenceBroker instances, so
it was easy enough for us to set up one or more listeners before we served
up any PersistenceBrokers.

Ron Gallagher
Atlanta, GA
ron dot gallagher at bellsouth dot net


-Original Message-
From: Coup, Robert Muir [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 30, 2004 12:51 AM
To: OJB Users List
Subject: Intercepting updates and inserts


Hi all,

We're using OJB to interface our application to an online database
(Postgre) as well as an offline database (HSQLDB). I'm in the process of
writing some simple replication code to allow offline updates to be
reconciled when the data is synchronised with the online database.

What I would like to do is to intercept each update or delete being run
by OJB and log some information about it (statement type, table, user,
time, etc) it to another table. I could make all the persistent objects
implement PersistenceBrokerAware and then do the logging in afterUpdate
and afterDelete, but that isn't a stunningly elegant solution and I was
wondering if there was another place I could hook into which wouldn't
involve making changes to my persistent classes? If not, where would be
the best place to jump into the OJB source to do what I need?

Thanks again,

Rob :)

-
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: Unique column

2004-02-14 Thread Ron Gallagher
Here's my recommendation:
1) Implement the PersistenceBrokerAware interface in your persistable object
(ie. Employee).
2) In the beforeInsert callback, check the database for a record with an
employee name that matches the employee name of this.
3) In the beforeUpdate callback, check the database for a record with an
employee name that matches the employee name of this and where the id of
the existing record doesn't match the primary key of this.
For steps 2) and 3), you can use the PersistenceBroker that's passed in via
the specified callback.  For details, check out the javadocs related to the
PersistenceBrokerAware interface.

Ron Gallagher
Atlanta,GA
rongallagher at bellsouth dot net


-Original Message-
From: Muhammad Aamir [mailto:[EMAIL PROTECTED]
Sent: Friday, February 13, 2004 7:59 AM
To: OJB Users List
Subject: RE: Unique column


Emp table cannot have ename as it's primary key e.g., (because empno is
it's PK). Further, although I asked particularly about unique column
actually I wanted to ask that how can we implement business rule that
depends on the same table.

For example if I don't want to use UNIQE constraint on database level or
want to do some query on same table

Thank you,
Aamir

-Original Message-
From: Edson Carlos Ericksson Richter
[mailto:[EMAIL PROTECTED]
Sent: Friday, February 13, 2004 6:46 PM
To: OJB Users List
Subject: Re: Unique column

Short answer: it's all in documentation. Look there.

Long answer:
As far you have not give more details, just set it as primary key. This
guarantee no duplicates, and no nulls. Don't forget to set this in
database too (all good databases around the world support primary keys).

Other way: in OJB uses it as normal field, and in database create a
UNIQUE index. Almost all databases knows the UNIQUE concept.

If it need be auto-generated, look docs about auto-increment. If it
isn't numeric, and need be unique, you can create your own Sequence
Manager. Check docs.

Best regards,

Edson Richter

  - Original Message -
  From: Muhammad Aamir
  To: OJB Users List
  Sent: Friday, February 13, 2004 9:25 AM
  Subject: RE: Unique column



  Re-post
  -Original Message-
  From: Muhammad Aamir
  Sent: Wednesday, February 11, 2004 9:51 AM
  To: [EMAIL PROTECTED]
  Subject: Unique column

  There is a column that I want it to be unique in the table. How can I
  implement this business rule ??

  Thanks
  Aamir

  -
  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.587 / Virus Database: 371 - Release Date: 12/2/2004

-
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:
insert-procedure name=du$zollpartner_t_b.ins
runtime-argument field-ref=ztb_id return=true/
runtime-argument field-ref=ztb_verband return=true/
runtime-argument field-ref=ztb_rechtsform return=true/
runtime-argument field-ref=ztb_anmeldedatum return=true/
runtime-argument field-ref=ztb_unterlagenzustelldatum
return=true/
runtime-argument field-ref=ztb_gueltigv return=true/
runtime-argument field-ref=ztb_gueltigb return=true/
runtime-argument field-ref=ztb_erstuser return=true/
runtime-argument field-ref=ztb_erstdat return=true/
runtime-argument field-ref=ztb_mutuser return=true/
runtime-argument field-ref=ztb_mutdat return=true/
runtime-argument field-ref=ztb_zpa_id return=true/
  /insert-procedure

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: Project start failed with Exception java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

2004-01-29 Thread Ron Gallagher
Sven --

The problem is found in the stack trace:

JGeo2] Exception in thread main java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException

You need to ensure that the commons-lang jar file is in your class path.

Check out http://db.apache.org/ojb/dependencies.html and
http://db.apache.org/ojb/deployment.html#3.%20Additional%20jar%20archives
for info on the JARs that are required.

Ron Gallagher
Atlanta, GA
rongallagher at bellsouth dot net

-Original Message-
From: Sven Alisch [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 29, 2004 12:01 PM
To: [EMAIL PROTECTED]
Subject: Project start failed with Exception
java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException


Hello ML,

I'am an absolute newbie with OJB. I finished installing. I use the ojb-blank
project as a template and try to compilate the following example:

class INSTITUT {

public INSTITUT(String name) {
iNST_NAME = name;
}

private Integer iNST_NR;

private String iNST_NAME;

private String sITZ;

private Integer gEH_NR;

private Date sEIT_DATUM;

public void showObjectContent() {
System.out.println(Objekt Inhalt);
System.out.println(iNST_NAME);
}

}


public class JGeo2 {

public static void main(String args[]) {
System.out.println(Hello OJB!);

PersistenceBroker broker = null;
try {
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
//QueryByCriteria query = new QueryByCriteria(new
INSTITUT(Informatik));
//INSTITUT result = (INSTITUT)
broker.getObjectByQuery(query);
//result.showObjectContent();
}
finally {
if (broker != null) broker.close();
}
}

}

The Database also exists. The repository.xml for my INSTITUT class looks
like:

class-descriptor class=geo2.INSTITUT table=INSTITUT
field-descriptor name=iNST_NR primarykey=true
default-fetch=true column=INST_NR jdbc-type=INTEGER/
field-descriptor name=iNST_NAME nullable=false
default-fetch=true column=INST_NAME jdbc-type=VARCHAR/
field-descriptor name=sITZ default-fetch=true
column=SITZ jdbc-type=VARCHAR/
field-descriptor name=gEH_NR nullable=false
default-fetch=true column=GEH_NR jdbc-type=SET('A', 'B')/
field-descriptor name=sEIT_DATUM default-fetch=true
column=SEIT_DATUM jdbc-type=DATE
conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFi
eldConversion/
/class-descriptor

if i start my project with

ant geotest (i included this target in my build.xml file)

i get following error:

 [JGeo2] Hello OJB!
[JGeo2] Exception in thread main java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException
[JGeo2] at java.lang.ClassLoader.defineClass0(Native Method)
[JGeo2] at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
[JGeo2] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[JGeo2] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[JGeo2] at
java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[JGeo2] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[JGeo2] at java.security.AccessController.doPrivileged(Native
Method)
[JGeo2] at
java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[JGeo2] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[JGeo2] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[JGeo2] at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[JGeo2] at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
own
Source)
[JGeo2] at JGeo2.main(Unknown Source)

Please help me, i can't find any solution for my Problem.

Thank you,
Greetings from Sven


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




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



RE: [Fwd: How to call a select store procedure in OJB]

2004-01-13 Thread Ron Gallagher
Suma --

Stored procedures are only supported for data persistence operations
(insert, update or delete).  Data retrieval (i.e. select) is still performed
by 'basic' sql statements.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 10, 2004 4:39 AM
To: OJB Users List
Subject: [Fwd: How to call a select store procedure in OJB]




 Original Message 
Subject:How to call a select store procedure in OJB
Date:   Fri, 9 Jan 2004 14:56:15 -0800 (PST)
From:   Suma Venkatesh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]



Hi

   Iam working on using store procedures using OJB. I want to call a
store procedure which selects a number of items from a table Product.I
want to be able to use a store procedure to do this and not a simple
select and query by collection.

I checked the repository.dtd which defines no such element. Is there a
way to acheive this in OJB ?

thanks in advance,
suma




Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://pa.yahoo.com/*http://us.rd.yahoo.com/hotjobs/mail_footer_email/evt=2
1482/*http://hotjobs.sweepstakes.yahoo.com/signingbonus


-
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: Calling custom store procedures in OJB

2004-01-13 Thread Ron Gallagher
Suma --

At this point, OJB's support for stored procedures is limited to just data
persistence operations (insert, update or delete).  Data retrieval (i.e.
select) is still performed by 'basic' sql statements.  I am aware of no
plans at this time to extend SP support to handle data retrieval.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Suma Venkatesh [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 11, 2004 6:07 PM
To: OJB Users List
Subject: Calling custom store procedures in OJB


Hi all,

   Iam working on using store procedures using OJB. I want to call a
  store procedure which selects a number of items from a table Product.I
  want to be able to use a store procedure to do this and not a simple
  select and query by collection.

  I checked the repository.dtd which defines no such element. Is there
  a way to acheive this in OJB ?

  To summarize: Is there a way to call a custom store procedure which does
NO insert,delete,update operations and just does some select operations in
OJB.

Please help me as Iam totally new to OJB!!

thanks in advance,
 suma


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



RE: join and retrieve single object?

2004-01-10 Thread Ron Gallagher
Daniel --

The Query interface defines a setDistinct(boolean) method.  Set this to
true and you should see better results.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Daniel Perry [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 9:41 AM
To: OJB Users List
Subject: join and retrieve single object?


I want to query the database and retrieve a specific manager, and only their
employees whoose training (boolean) matches the requirement.  Instead of
getting one manager with the x (out of y) employees, i get x managers.
My code is: (getObjectsByType) is just a query by criteria shortcut.

Criteria crit = new Criteria();
crit.addEqualTo(id, new Integer(managerId));
crit.addEqualTo(employees.training, new Boolean(training));
List mgrs = getObjectsByType(Manager.class.getName(), crit);
System.out.println(MANAGERS FOUND:  + Integer.toString(mgrs.size()));

Is there any way to get just the one manager?

Daniel.


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



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



RE: BATCH-MODE problem (repost)

2003-12-18 Thread Ron Gallagher
Oleg/Stephane --

I am pretty certain that this problem is gone in RC5.  Back in July, I
submitted a bug report/patch to document/fix this problem.  Revision 1.7 of
o.a.o.b.util.batch.PreparedStatementInvocationHandler was created on/about
July 29, and it contains this fix.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Oleg Nitz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 7:59 PM
To: OJB Users List
Subject: Re: BATCH-MODE problem (repost)


Hi Stéphane,

sorry for the delay. Unfortunately, the stack trace doesn't show line
numbers
for OJB classes. Probably this is because the jar for the release is build
without debug info.
Also I would like to know which version do you use.
That would be great if you get RC5 sources, build target jar-debug and
re-run
your app. Actually if you used earlier release, you may find that the
problem
disappears with RC5 ;-)

Oleg

On Tuesday 16 December 2003 12:33, Stéphane El Guedj wrote:
 Hi,

 I'm currently trying to improve my app performances and I therefore tried
 to set the batch-mode property in the repository to true. Unfortunately,
 whenever OJB attempts to submit the batch, I get the following exception:

 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:3
9 )
 at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
l .java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at

org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecu
t e(Unknown Source)
 at

org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(
U nknown Source)
 at $Proxy0.doExecute(Unknown Source)
 at
 org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown
 Source)
 at
 org.apache.ojb.broker.util.batch.BatchConnection.nextExecuted(Unknown
 Source)
 at

org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(
U nknown Source)
 at $Proxy0.executeUpdate(Unknown Source)
 at
 org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdate(Unknown
 Source)
 at
 org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
 Source)
 at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
 Source)Notif 4240 - act: 4832

 at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
 Source)
 at
 org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
 Source)
 at
 org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
 Source)
 at Test.main(Test.java:110)


 I am using Oracle 8i and OJB 1.0rc4.
 Here is an excerpt from my repository:

   jdbc-connection-descriptor
   default-connection=true
   jcd-alias=bod
   platform=oracle
   jdbc-level=2.0
   driver=oracle.jdbc.driver.OracleDriver
   protocol=jdbc
   subprotocol=oracle:thin
   dbalias=@superbug:1521:dbmaster
   username=SEJ
   password=SEJ
   batch-mode=true

   connection-pool
   maxActive=15
   whenExhaustedAction=0
   testOnBorrow=false
   testOnReturn=false
   validationQuery=select count(*) from OJB_HL_SEQ
   /

   sequence-manager

className=org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl
 attribute attribute-name=autoNaming
 attribute-value=true/
   /sequence-manager


   /jdbc-connection-descriptor


 Here is a code excerpt:

   broker.beginTransaction();
   broker.serviceConnectionManager().setBatchMode(true);
   broker.store(o);
   broker.commitTransaction();


 My question: can I use batch-mode with Oracle, and if so, do I use the
 right driver...

 Thanks in advance.
 Regards
 Stiphane El Guedj


 -
 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: confused about how to port some sql queries...

2003-11-24 Thread Ron Gallagher
Jason --

For my answer, I'll assume that you have a class-descriptor for the class
Timeclock that is 'mapped' to the 'timeclock' table, and that this
class-descriptor has the following field-descriptors

attributeName mappedToColumn
= ==
tSin  tsin
refEmployee   ref_employee
tsOut tsout

With those assumptions, here's how you would accomplish your query:

// Assemble the criteria
Criteria criteria = new Criteria();
criteria.addEqualTo(refEmployee,someValueForRefEmployee);
criteria.addEqualTo(tsOut,someValueForTsOut);

// What columns should be included?
String columns[] = new String[1]{min(tSin)};

ReportQueryByCriteria query =
QueryFactory.newReportQuery(Timeclock.class,columns,criteria,true);

The last argument (true in my example) tell OJB whether or not you want
distinct rows returned.  Setting it to true causes OJB to insert the
DISTINCT keyword in the generated sql.

As far as the 'targetClass' is concerned, this identifies the
class-descriptor that is the basis for which the various attributes (i.e.
refEmployee, tsOut and tSin) that are found in the criteria/column
list are resolved to actual table/column names.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]



-Original Message-
From: Jason Pyeron [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 22, 2003 9:03 PM
To: OJB Users List
Subject: confused about how to port some sql queries...



I have a prepared statement like so:

SELECT min(tsin) FROM timeclock WHERE ref_employee= ? AND tsout=0;


I use this to decide what to query next, it sounds like I should use the
report feature in OJB but I have no idea how.

I looked at

ReportQueryByCriteria(java.lang.Class targetClass, java.lang.String[]
columns, Criteria criteria)

what is this targetClass?

Sincerely,

Jason Pyeron

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron   http://www.pyerotechnics.com   -
- Partner  Sr. Manager Pyerotechnics Development, Inc. -
- +1 (443) 451-2697 500 West University Parkway #1S -
- +1 (410) 808-6646 (c) Baltimore, Maryland  21210-3253 -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you
have received it in error, purge the message from your system and
notify the sender immediately.  Any other use of the email by you
is prohibited.




-
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: confused about how to port some sql queries...

2003-11-24 Thread Ron Gallagher
Jason --

For my answer, I'll assume that you have a class-descriptor for the class
Timeclock that is 'mapped' to the 'timeclock' table, and that this
class-descriptor has the following field-descriptors

attributeName mappedToColumn
= ==
tSin  tsin
refEmployee   ref_employee
tsOut tsout

With those assumptions, here's how you would accomplish your query:

// Assemble the criteria
Criteria criteria = new Criteria();
criteria.addEqualTo(refEmployee,someValueForRefEmployee);
criteria.addEqualTo(tsOut,someValueForTsOut);

// What columns should be included?
String columns[] = new String[1]{min(tSin)};

ReportQueryByCriteria query =
QueryFactory.newReportQuery(Timeclock.class,columns,criteria,true);

The last argument (true in my example) tell OJB whether or not you want
distinct rows returned.  Setting it to true causes OJB to insert the
DISTINCT keyword in the generated sql.

As far as the 'targetClass' is concerned, this identifies the
class-descriptor that is the basis for which the various attributes (i.e.
refEmployee, tsOut and tSin) that are found in the criteria/column
list are resolved to actual table/column names.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Jason Pyeron [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 22, 2003 9:03 PM
To: OJB Users List
Subject: confused about how to port some sql queries...



I have a prepared statement like so:

SELECT min(tsin) FROM timeclock WHERE ref_employee= ? AND tsout=0;


I use this to decide what to query next, it sounds like I should use the
report feature in OJB but I have no idea how.

I looked at

ReportQueryByCriteria(java.lang.Class targetClass, java.lang.String[]
columns, Criteria criteria)

what is this targetClass?

Sincerely,

Jason Pyeron

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron   http://www.pyerotechnics.com   -
- Partner  Sr. Manager Pyerotechnics Development, Inc. -
- +1 (443) 451-2697 500 West University Parkway #1S -
- +1 (410) 808-6646 (c) Baltimore, Maryland  21210-3253 -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you
have received it in error, purge the message from your system and
notify the sender immediately.  Any other use of the email by you
is prohibited.




-
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 procedures in MS SQL

2003-11-24 Thread Ron Gallagher
Sergey --

I just submitted to the OJB-dev mailing list an update to the documentation
related to OJB's support for stored procedures.  Look for it to appear on
the OJB website sometime soon.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Sergey V. Oudaltsov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 10:29 AM
To: OJB Users List
Subject: RE: Stored procedures in MS SQL


 I don't think that the current documentation was meant to imply that
 it only works for Oracle, however, the docs are out of sync with CVS
 at the moment. OJB CVS has support for using repository.xml to define
 sp's for insert, update, and delete of objects.

Well, the question is how stable is CVS now - and when could we expect
the version supporting stored procs? Week, month, year? I don't mind
trying CVS - but I have to be sure the release of our project will have
some stable version of OJB to ship with.


 If you can't/do not wish to get CVS code, you should still be able to
 make it work with MS SQL using the current documentation, just
 implement your stored procedures as you would normally and ignore the
 Oracle-specific parts of the docs.

Well, current documentation only explains some steps people taken to
support Oracle stored procs (in some package com.xxx:) - not even the
existing support in OJB.


--
Sergey


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



Re: modifing JdbConnectionDescriptor at runtime

2003-11-07 Thread Ron Gallagher
Sven --

The call to connectionRepository().getAllDescriptor() returns a deep copy of all of 
the connection descriptors, so any changes you make to those descriptors will not be 
reflected in the global repository.  To do that, you'll have to remove the descriptor 
from the global repository and re-add it.  Something like after you call 
changeDescriptor method should work:

ConnectionRepository connRepo =
MetadataManager.getInstance().connectionRepository();
connRepo.removeDescriptor(desc);
connRepo.addDescriptor(desc);

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: [EMAIL PROTECTED]
 Date: 2003/11/07 Fri AM 06:33:01 EST
 To: [EMAIL PROTECTED]
 Subject: modifing JdbConnectionDescriptor at runtime
 
 Hi,
 I'm trying to modify the default jdbcconnectiondescriptor at runtime.
 I do this by change the PersistenceBrokerFactory implementation to my custom
 class, which extends PersistenceBrokerFactoryDefaultImpl and adds a static
 part like this:
 
   static {
   List descriptors =
 MetadataManager.getInstance().connectionRepository().getAllDescriptor();
   for (Iterator iter = descriptors.iterator();
 iter.hasNext();) {
   JdbcConnectionDescriptor desc =
 (JdbcConnectionDescriptor) iter.next();
   if (desc.isDefaultConnection()) {
   changeDescriptor(desc);
   }
   }
   }
 
   private static void changeDescriptor(JdbcConnectionDescriptor desc)
 {
   // modifies the descriptor
   String dbname = Props.getString(dbname);
   String dbhost = Props.getString(dbhost);
   String dbalias = // + dbhost + / + dbname;
   log.debug(changeDescriptor - setting dbAlias :  +
 dbalias);
   connectionDescriptor.setDbAlias(dbalias);
 
   // do this for username, password etc. 
   }
 
 there is no problem with this all the properties are set. But it seems that
 another operation resets the dbalias, because I get the following error:
   
   Error getting Connection from DriverManager with url
 (jdbc:postgresql:) and driver (org.postgresql.Driver)
 
 I'm using 1.0 rc4.
 
 Any ideas?
 Sven
 
 -
 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: Use stored procedure for insert questions

2003-11-07 Thread ron . gallagher
Thierry --

You shouldn't need to use a sequence manager since the SP is assigning the
id.  Based on the configuration of the 'insert-procedure' descriptor, the
first argument to the sp will be defined as either 'OUT' or 'IN OUT'.   In
either case, the value that's returned by the sp will be placed in the 'id'
attribute on the 'Twtinstances' class.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: Thierry Hanot [mailto:[EMAIL PROTECTED]
Sent: Friday, November 07, 2003 10:20 AM
To: 'OJB Users List'
Subject: Use stored procedure for insert questions


Hello All
I currently trying to use the cvs version of ojb 1.0 with an Oracle 9i
Database and I have a few problem with stored procedure and sequences:


1: I want to Stored procedure for insert some rows.
The stored procedure return the id ( primary key ) of the row.But i don't
know wich sequence manager i need to use for managing this class .

Here is the class descriptor:

class-descriptor class=com.infovista.vm.ojb.Twtinstances
table=VMUSER.TWTINSTANCES
field-descriptor name=cdate column=CDATE
jdbc-type=TIMESTAMP/
field-descriptor name=configid column=CONFIGID
jdbc-type=BIGINT/
field-descriptor name=datasync column=DATASYNC
jdbc-type=BIGINT/
field-descriptor name=description column=DESCRIPTION
jdbc-type=VARCHAR/
field-descriptor name=id column=ID jdbc-type=BIGINT
primarykey=true /
insert-procedure name=ADDINSTANCE
runtime-argument field-ref=id return=true/
runtime-argument field-ref=description
return=false/
runtime-argument field-ref=datasync
return=false/
runtime-argument field-ref=configid
return=false/
/insert-procedure
/class-descriptor


But i don't find any way to use it correctly in ojb .
First i didn't define any sequence manager , the PB refuse to insert any
instance .
Second try : using the SequenceManagerNativeImpl ( not implemented for this
plateform ).




2: One other question concern the repository.dtd wich has the following
lines on the stored procedures:


!ELEMENT insert-procedure (documentation?, (runtime-argument |
constant-argument)?, attribute*)
!ATTLIST insert-procedure
name CDATA #REQUIRED
return-field-ref CDATA #IMPLIED
include-all-fields (true | false) false



A procedure could have one to many arguments , I just wonder if we should
have 

!ELEMENT insert-procedure (documentation?, (runtime-argument |
constant-argument)+, attribute*)
!ATTLIST insert-procedure
name CDATA #REQUIRED
return-field-ref CDATA #IMPLIED
include-all-fields (true | false) false






3: Is it possible to use different sequence manager in the same repository
??? If yes how ?


B.R


Thierry Hanot 

-
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: Use stored procedure for insert questions

2003-11-07 Thread ron . gallagher
Based on the configuration of the 'insert-procedure' descriptor that you
provided earlier, here's the syntax of a procedure that 'should' work.
Please not that the compiler on my email editor is not working right now, so
I have no way of confirming if the syntax is correct.  However, the basic
structure is correct.

CREATE OR REPLACE PROCEDURE ADDINSTANCE 
   ( aID  OUT TWTINSTANCES.ID%TYPE 
   , aDESCRIPTION IN  TWTINSTANCES.DESCRIPTION%TYPE
   , aDATASYNCIN  TWTINSTANCES.DATASYNC%TYPE
   , aCONFIGIDIN  TWTINSTANCES.CONFIGID%TYPE)
   IS 

BEGIN

   -- Get next value from the sequence
   -- This will put the value in the 'out' parameter named aID
   SELECT YourSequenceNameHere.NEXTVAL
 INTO aID
 FROM DUAL;
   
   -- Insert the record
   INSERT INTO TWTINSTANCES
  (ID,
   DESCRIPTION,
   DATASYNC,
   CONFIGID)
   VALUES
  (aID,
   aDESCRIPTION,
   aDATASYNC,
   aCONFIGID);
END;

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Thierry Hanot [mailto:[EMAIL PROTECTED]
Sent: Friday, November 07, 2003 10:58 AM
To: 'OJB Users List'
Subject: RE: Use stored procedure for insert questions


Thanks But how to do it , because there is no documentation on it ???
I probably did a wrong descriptor on the insert-procedure  . 

B.R 
Thierry 




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 07, 2003 4:31 PM
To: [EMAIL PROTECTED]
Subject: RE: Use stored procedure for insert questions


Thierry --

You shouldn't need to use a sequence manager since the SP is assigning the
id.  Based on the configuration of the 'insert-procedure' descriptor, the
first argument to the sp will be defined as either 'OUT' or 'IN OUT'.   In
either case, the value that's returned by the sp will be placed in the 'id'
attribute on the 'Twtinstances' class.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: Thierry Hanot [mailto:[EMAIL PROTECTED]
Sent: Friday, November 07, 2003 10:20 AM
To: 'OJB Users List'
Subject: Use stored procedure for insert questions


Hello All
I currently trying to use the cvs version of ojb 1.0 with an Oracle 9i
Database and I have a few problem with stored procedure and sequences:


1: I want to Stored procedure for insert some rows.
The stored procedure return the id ( primary key ) of the row.But i don't
know wich sequence manager i need to use for managing this class .

Here is the class descriptor:

class-descriptor class=com.infovista.vm.ojb.Twtinstances
table=VMUSER.TWTINSTANCES
field-descriptor name=cdate column=CDATE
jdbc-type=TIMESTAMP/
field-descriptor name=configid column=CONFIGID
jdbc-type=BIGINT/
field-descriptor name=datasync column=DATASYNC
jdbc-type=BIGINT/
field-descriptor name=description column=DESCRIPTION
jdbc-type=VARCHAR/
field-descriptor name=id column=ID jdbc-type=BIGINT
primarykey=true /
insert-procedure name=ADDINSTANCE
runtime-argument field-ref=id return=true/
runtime-argument field-ref=description
return=false/
runtime-argument field-ref=datasync
return=false/
runtime-argument field-ref=configid
return=false/
/insert-procedure
/class-descriptor


But i don't find any way to use it correctly in ojb .
First i didn't define any sequence manager , the PB refuse to insert any
instance . Second try : using the SequenceManagerNativeImpl ( not
implemented for this plateform ).




2: One other question concern the repository.dtd wich has the following
lines on the stored procedures:


!ELEMENT insert-procedure (documentation?, (runtime-argument |
constant-argument)?, attribute*) !ATTLIST insert-procedure
name CDATA #REQUIRED
return-field-ref CDATA #IMPLIED
include-all-fields (true | false) false



A procedure could have one to many arguments , I just wonder if we should
have 

!ELEMENT insert-procedure (documentation?, (runtime-argument |
constant-argument)+, attribute*) !ATTLIST insert-procedure
name CDATA #REQUIRED
return-field-ref CDATA #IMPLIED
include-all-fields (true | false) false






3: Is it possible to use different sequence manager in the same repository
??? If yes how ?


B.R


Thierry Hanot 

-
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: Stored Procedure Question ? ( from newbies )

2003-11-05 Thread ron . gallagher
Thierry -- 

Support for using stored procedures for insert, update and delete operations
has been incorporated into the 'internals' of the PB api, so there's no
longer any need to implement the extensions that are described in the HOWTO
Work With Stored Procedures document.  I apologize for not getting around
to updating the 'how to' documentation to reflect this capability.

The repository.dtd file has been updated with some basic information about
the various descriptors that you need to include in your repository.  Just
search on 'procedure' and you'll find all of the relevant information.

I'll try to get the 'how to' documentation updated over the next few days.
In the meantime, if you have any questions, just post them to the mailing
lists and I'll answer them as best I can.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: Thierry Hanot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 6:02 AM
To: [EMAIL PROTECTED]
Subject: Stored Procedure Question ? ( from newbies ) 


Hello All
 
I'm new to ojb and i'm currently trying to implement the method describe in
the HowTo  Stored Procedure with Ojb. And i have a few questions
First : Is the code for this Howto available somewhere ? Even if i know that
the code is a bit specific, i just want to have for validating my own
implementation ( on missing method description such as
getObjectFromStatement ... )
 
My second question is 
-the howto describe a method which is extending the StatementManager ,
is it possible for avoiding this 
to use the a StatementFactory which is allocating a
CallableStatementForClass is the class has stored procedure
or an other ( StatementsForClassImpl ) if the class descriptor hasn't.
Instead of registring OutParameters in the StatementManger can we do it
in the StatementForClass implementation.
  
 
Tks
 
Thierry Hanot 
 

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



RE: Problem on insert

2003-11-05 Thread ron . gallagher
Vincent --

The PersistenceBroker interface defines two methods for storing an object:

  public void store(Object)
  public void store(Object,ObjectModification)

If you use the first 'store' method, OJB will run a query against the
database to determine if the Object that is being stored already exists.  If
the record exists, then OJB will update that record.  If the record doesn't
exist, then OJB will insert a new record.

Based on the description of your problem, you're using the first 'store'
method.  To change this behavior, just use the second method and pass either
ObjectModificationDefaultImpl.INSERT or ObjectModificationDefaultImpl.UPDATE
as the second argument.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Arbona Vincent [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 8:36 AM
To: [EMAIL PROTECTED]
Subject: Problem on insert


Hi,
 
I have the following problem:
 
I am using the PB API and I want to ensure that when an object is stored in
base, it is not possible to insert it twice (ie to insert an object with the
same PK value)
 
Until now, the second insert is in fact an update!!
 
But what I want is an Exception that tells me This object already exists
or something like that
 
Thanks
 
Vincent ARBONA
Architecte Logiciel
 
Sopra Group
Espace Performance 3
Bâtiment P
35760 Saint Grégoire
 
[EMAIL PROTECTED]
tel : 02-23-25-25-73
fax : 02-23-25-25-26
 

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



RE: org.apache.ojb.broker.OJBRuntimeException: Incorrect field re ference

2003-11-04 Thread ron . gallagher
Singh --

Check your inverse-foreignkey element.  There is a trailing space in the
'field-ref' property.  Take it out and things should work better.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Naveen Singh [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 2:20 PM
To: OJB Users List
Subject: org.apache.ojb.broker.OJBRuntimeException: Incorrect field
reference


HI,
Thanks in advance.
I am getting this error while doing:

Criteria courseNmCrit = new Criteria();
courseNmCrit.addEqualTo(unitNm, new Integer(1));
QueryByCriteria crsQuery =
QueryFactory.newQuery(Units.class,courseNmCrit);
Units unit =
(Units)newDbPersistenceBroker.getObjectByQuery(crsQuery);  //error comes
at this line

Here is the stack trace-

org.apache.ojb.broker.OJBRuntimeException: Incorrect field reference
unitId  in
[EMAIL PROTECTED]
delete=false,cascade retrieve=true,cascade store=false,is
lazy=false,class of Items=class
edu.sc.asg.astronomy.persistence.ojb.StudentUnitDtl]
at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFi
eldDescriptors(Unknown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getFKQuery1toN(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getFKQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unkn
own Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unk
nown Source)
at
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unkn
own Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)

Caused by: java.util.NoSuchElementException: Could not obtain next
object: Incorrect field reference unitId  in
[EMAIL PROTECTED]
delete=false,cascade retrieve=true,cascade store=false,is
lazy=false,class of Items=class
edu.sc.asg.astronomy.persistence.ojb.StudentUnitDtl]
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)
... 43 more

Here is the part of Repository.xml

class-descriptor 
  class=edu.sc.asg.astronomy.persistence.ojb.StudentUnitDtl
  table=astronomy.dbo.student_unit_dtl
  field-descriptor 
 name=completedUnitFlg
 column=completed_unit_flg
 jdbc-type=CHAR
  /
  field-descriptor 
 name=statusDt
 column=status_dt
 jdbc-type=DATE
  /
  field-descriptor 
 name=studentId
 column=student_id
 jdbc-type=INTEGER
  /
  field-descriptor 
 name=studentUnitDtlId
 column=student_unit_dtl_id
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor 
 name=studentUnitStatusId
 column=student_unit_status_id
 jdbc-type=INTEGER
  /
  field-descriptor 
 name=unitId
 column=unit_id
 jdbc-type=INTEGER
  /
  reference-descriptor
name=aUnits
class-ref=edu.sc.asg.astronomy.persistence.ojb.Units
auto-retrieve=true
auto-update=false
auto-delete=false
foreignkey field-ref=unitId /
  /reference-descriptor
/class-descriptor

class-descriptor 
  class=edu.sc.asg.astronomy.persistence.ojb.Units
  table=astronomy.dbo.units
  field-descriptor 
 name=unitId
 column=unit_id
 jdbc-type=INTEGER
 primarykey=true
 autoincrement=true
  /
  field-descriptor 
 name=unitNm
 column=unit_nm
 jdbc-type=INTEGER
  /
  field-descriptor 
 name=unitTx
 column=unit_tx
 jdbc-type=VARCHAR
  /
 collection-descriptor
name=collStudentUnitDtl
 
element-class-ref=edu.sc.asg.astronomy.persistence.ojb.StudentUnitDtl
auto-retrieve=true
auto-update=false
auto-delete=false
inverse-foreignkey field-ref=unitId /
  /collection-descriptor
/class-descriptor

-
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: Connection Manager Question

2003-10-13 Thread ron . gallagher
Oscar --

The serviceConnectionManager method has been a part of the PersistenceBroker
interface since rev 1.14, 2002/12/24.  Is there any chance you have an old
copy of the OJB classes in your classpath?

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: Oscar Quinteros [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2003 1:53 AM
To: [EMAIL PROTECTED]
Subject: Connection Manager Question


Hi, I am a new user from the Republic Argentina
I have tried to obtain an object Connection the following way:

PersistenceBroker broker = null;
broker = PersistenceBrokerFactory.defaultPersistenceBroker(); 
Connection con = broker.serviceConnectionManager().getConnection(); 

But the compiler gives Java he tells me that the Method 
serviceConnectionManager doesn't exist in the interface 
org.apache.ojb.broker.PersistenceBroker
I am using the version 1.0.rc4, and in the same one the documentation 
says that the method exists.

Here is the stack trace:
cannot resolve symbol
[javac]symbol  : method serviceConnectionManager  ()
[javac]location: interface org.apache.ojb.broker.PersistenceBroker
[javac]Connection con = broker.serviceConnectionManager().getConnection
();

Thank you for the Attention
Oscar Eduardo Quinteros
---








-
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: postgresql

2003-10-10 Thread ron . gallagher
In your jdbc-connection-descriptor, set the platform attribute to
PostgreSQL.  Watch the case.  OJB uses this value as-is to locate the
platform implementation class.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: kimbuba [mailto:[EMAIL PROTECTED]
Sent: Friday, October 10, 2003 1:48 PM
To: OJB Users List
Subject: postgresql


Hello guys.
i've tried apache project: Object Relational Bridge
Everything seems to work properly.

But with postgresql i got this problem:

[DEFAULT] WARN: [PlatformFactory] problems with platform
org.apache.ojb.broker.platforms.PlatformPostgresqlImpl: org.apa
che.ojb.broker.platforms.PlatformPostgresqlImpl
[DEFAULT] WARN: [PlatformFactory] OJB will use PlatformDefaultImpl instead


It seems that it doesn't work with it's own PlatformPostgresqlImpl, so it
switch to the generic one.
Selects work, but update don't!
Did you have the same problems?
did u succeed in making work OJB with postgresql?

My config:
OJB 1.0 rc4
jdk-1.4.2.01_2(win xp)  / tried also on freebsd(4.8) jdk-1.4.1 patchset 3
jakarta-tomcat-4.1.27
postgresql-7.3.4_1
drivers tried:
http://jdbc.postgresql.org/download/pg73jdbc1.jar
http://jdbc.postgresql.org/download/pg73jdbc2.jar
http://jdbc.postgresql.org/download/pg73jdbc3.jar

THNX ALL!



-
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: Choose columns to update

2003-10-09 Thread ron . gallagher
Norbert --

As far as excluding certain columns from an insert/update statement, setting
the 'access' property on an field-descriptor to 'readonly' will cause that
field/column to be excluded from any insert/update statement that is
generated by ojb.

As far as getting OJB to issue an insert statement in lieu of an update
statement, the PersistenceBroker interface defines two methods for storing
objects:
public void store(Object obj);
public void store(Object obj, ObjectModification modification);
If you call the second version of this method and pass
org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT for the
'modification' argument, then ojb will issue an insert statement.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 10:13 AM
To: [EMAIL PROTECTED]
Subject: Choose columns to update


Hi all,

we use OJB1.0 RC4 against a DB2.
We want to tell OJB which columns should be included in the update statement
instead of updating all of them. The columns to update have the same name
and definition in all the tables.

Detailled information:
We have tables with many columns. Some columns hold only 'technical'
information like lastupdate timestamp and occur in each table. Whenever a
record is modified, we *insert* a new one and update these technical
attributes of the previously valid record (i.e. we are historizing the
changes). The tables also have many indexes. Therefore, updates on all
fields are costy (beside the bigger effort to build the query, higher
network traffic to the database and the obvious bigger overhead for the
database, it seems that these non-affected fields also cause costy index
calculations ond the database if incuded in the update).
What we actually need would be another descriptor for each table which
describes only this subset of columns to update. But this would cause many
more descriptors and classes. Because all information is already in the
objects and in the descriptors, we do not consider this as a solution.
The only thing we need is to tell OJB not to include every column in the
update statement (respectively which columns to include, similar to a
ReportQuery). How to do this?

Thanks in advance,
Norbert.

-
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: Choose columns to update

2003-10-09 Thread ron . gallagher
Norbert --

Have you considered utilizing the stored procedure support that's now
available on OJB?

For each table, you would simply rely on the 'standard' OJB logic for
handling insert and delete operations.  For update operations, you would set
up an update-procedure descriptor that identifies the stored procedure that
would handle the update operation.  In this stored procedure, you would do
exactly what you describe below:  Update the existing record as necessary
and create a new record.  Since the same pattern applies to all 80 tables,
you could probably set up some sort of code generation process to create the
update procedures for each of the 80 tables.

Just a thought.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 8:37 AM
To: [EMAIL PROTECTED]
Subject: RE: Choose columns to update


Hi Ron,
thanks for your reply.
Setting the access property is not suitable, because for each modification a
client does, we have to update one record, and insert another one. The
update touches only 2 fields. The insert naturally has to write all fields.
Could be solved with 2 descriptors on the same table. But this behaviour is
generic for all our 80 tables. If we find a generic solution, we could save
a lot of 'useless' code.
Somehow the best solution would be if OJB includes only those attributes in
the update query which indeed were changed.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 09. Oktober 2003 14:19
To: [EMAIL PROTECTED]
Subject: RE: Choose columns to update


Norbert --

As far as excluding certain columns from an insert/update statement, setting
the 'access' property on an field-descriptor to 'readonly' will cause that
field/column to be excluded from any insert/update statement that is
generated by ojb.

As far as getting OJB to issue an insert statement in lieu of an update
statement, the PersistenceBroker interface defines two methods for storing
objects:
public void store(Object obj);
public void store(Object obj, ObjectModification modification);
If you call the second version of this method and pass
org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT for the
'modification' argument, then ojb will issue an insert statement.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 10:13 AM
To: [EMAIL PROTECTED]
Subject: Choose columns to update


Hi all,

we use OJB1.0 RC4 against a DB2.
We want to tell OJB which columns should be included in the update statement
instead of updating all of them. The columns to update have the same name
and definition in all the tables.

Detailled information:
We have tables with many columns. Some columns hold only 'technical'
information like lastupdate timestamp and occur in each table. Whenever a
record is modified, we *insert* a new one and update these technical
attributes of the previously valid record (i.e. we are historizing the
changes). The tables also have many indexes. Therefore, updates on all
fields are costy (beside the bigger effort to build the query, higher
network traffic to the database and the obvious bigger overhead for the
database, it seems that these non-affected fields also cause costy index
calculations ond the database if incuded in the update).
What we actually need would be another descriptor for each table which
describes only this subset of columns to update. But this would cause many
more descriptors and classes. Because all information is already in the
objects and in the descriptors, we do not consider this as a solution.
The only thing we need is to tell OJB not to include every column in the
update statement (respectively which columns to include, similar to a
ReportQuery). How to do this?

Thanks in advance,
Norbert.

-
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: SCHEMA

2003-09-21 Thread Ron Gallagher
Cesar --

You may want to take a look at the 'profiles' capability within the metadata manager.  
In your case, you'd set up a separate profile for each company.  The only difference 
between the profiles would be the schema name assigned to each class descriptor.

At start up, your repository.xml would contain a single set of class-descriptors with 
no schema name set.  Then, you'd do the following for each company:
1) Get the original DescriptorRepository via the copyOfGlobalRepository.
2) Loop through all class descriptors and set the schema name accordingly.
3) Add the profile via the MetadataManager::addProfile method.  Since your profiles 
are company specific, you can use the name of the company as the 'key' for the profile.

Then, after you acquire a PersistenceBroker, you'd tell the MetadataManager to load 
the profile that is specific to the 'current' company.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


 
 From: cesar.leite [EMAIL PROTECTED]
 Date: 2003/09/21 Sun AM 09:11:56 EDT
 To: [EMAIL PROTECTED]
 Subject: Re: SCHEMA
 
 Hi Wayne
 
 I read in emails this solution but my problem is that my
 application work N companies and for each company I have a
 schema different i'am working with DB2 and this solution is
 not best in my the case.
 
 Is There another solution with ojb?
 
 [ ]´s
 Cesar
 
  When a PersistenceBrokerFactory creates a PersistenceBroker
 instance, it
  can specify a different jcdalias.  That alias can work again
 st the same
  repository.xml but a different url (accessing a different da
 tabase).  In
  order for this to work properly, the OJB.properties should s
 pecify
  ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerB
 rokerImpl
 
  so that seperate caches are maintained for the separate
  PersistenceBroker instances.
 
  Wayne
 
 
  cesar.leite wrote:
 
  Hi
  I would like to know if with ojb i can change my schema whe
 n
  i'm executing my program?
  
  Example: I can use the SCHEMA1.PRODUCT and later I can use
  SCHEMA2.PRODUCT to have access the same table product.
  
  thanks.
  Cesar
  
  
  ---
  Acabe com aquelas janelinhas que pulam na sua tela.
  AntiPop-up UOL - É grátis!
  http://antipopup.uol.com.br
  
  
  ---
 --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: ojb-user-
 [EMAIL PROTECTED]
  
  
 
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 ---
 Acabe com aquelas janelinhas que pulam na sua tela.
 AntiPop-up UOL - É grátis!
 http://antipopup.uol.com.br
 
 
 -
 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: How to Set Last Updated Time Automatically?

2003-09-18 Thread Ron Gallagher
Gene --

There are two interfaces designed to handle this situation: 
org.apache.ojb.broker.PBLifeCycleListener and 
org.apache.ojb.broker.PersistenceBrokerAware.

The PBLifeCycleListener interface can be used by any object.  Just implement the 
interface in your class and register it as a listener with the PersistenceBroker.  
PBLifeCycleListener includes two methods, beforeInsert and beforeUpdate, that are well 
suited for your situation.

The PersistenceBrokerAwareinterface is intended to be used by a persistence-capable 
class.  PersistenceBrokerAwareinterface defines two methods with the same names that 
can also be used in your situation.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 From: Gene Qian [EMAIL PROTECTED]
 Date: 2003/09/18 Thu AM 01:13:59 EDT
 To: [EMAIL PROTECTED]
 Subject: How to Set Last Updated Time Automatically?
 
 Hi,
 
 I have a persistent field, say, lastUpdated(column is 
 LAST_UPDATED_DATETIME), which is used to store last updated time of the db 
 record. My question is: Can we use OBJ automatically set and store the field 
 with right datetime when the persistent object was stored to DB with any 
 field value changed? If so, how to do?
 
 Any comments will be appreciated.
 
 Gene



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



RE: Compile for JDK 1.3?

2003-08-14 Thread Ron Gallagher
There's another jdk 1.3 compile problem related to the recent changes to 
FieldDescriptor:

preprocess:
 [echo] using switches: +JDK13, -JDBC30
 [java] 

main:
[javac] Compiling 502 source files to C:\temp\OpenSource\db-ojb\target\classes
[javac] 
C:\temp\OpenSource\db-ojb\target\src\org\apache\ojb\broker\metadata\FieldDescriptor.java:218:
 cannot resolve  symbol
[javac] symbol  : variable BOOLEAN
[javac] location: class java.sql.Types
[javac] result = Types.BOOLEAN;
[javac]   ^
[javac] 1 error

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 11:58 AM
To: OJB Users List
Subject: Re: Compile for JDK 1.3?


Hi Daniel,

It's a slip with the RC4 releas. we normally provide build compatibility 
for jdk 1.2, 1.3 and 1.4.
You can either use JDK 1.4
or remove the source package o.a.ojb.otm to work around this issue.
Will be fixed with next public release.

cheers,
Thomas

[EMAIL PROTECTED] wrote:
 I am following the quickstart.html directions and trying to run bin\build
 junit using JDK 1.3.1.  It looks like a targeted effort was made to get
 this work with JDKs other than 1.4.  However, the compile fails due to a
 dependency on a JDK 1.4 class.  Is this a bug? or must we use JDK 1.4 or
 better.
 
 The stack trace is as follows:
 
 C:\db-ojb-1.0.rc4bin\build junit
 Buildfile: build.xml
 
 splash:
 
 set-archive-name:
 
 set-archive-name-date:
 
 detect-jdk:
 
 check-jdk12proxy-classes:
 
 check-jndi-classes:
 
 use-jdk12:
 
 use-jdk13:
  [echo] detected JDK 1.3
 
 use-jdk14:
 
 init:
 
 prepare:
  [copy] Copying 586 files to C:\db-ojb-1.0.rc4\target\src
  [copy] Copying 259 files to C:\db-ojb-1.0.rc4\target\srctest
  [copy] Copying 10 files to C:\db-ojb-1.0.rc4\target\srcjca
 
 check-j2ee-classes:
 
 preprocess:
  [echo] using switches: +JDK13, -JDBC30
  [java]
 
 
 
 
 
 
 
 
 
 
 
 
 
 .
  [java]
 
 
 
 
 
 ...
 
 main:
 [javac] Compiling 549 source files to C:\db-ojb-1.0.rc4\target\classes
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\MetadataObjectC
 opyStrategy.java:69: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: package util
 [javac] import java.util.IdentityHashMap;
 [javac]  ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\ReflectiveObjec
 tCopyStrategy.java:68: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: package util
 [javac] import java.util.IdentityHashMap;
 [javac]  ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\MetadataObjectC
 opyStrategy.java:100: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: class
 org.apache.ojb.otm.copy.MetadataObjectCopyStrategy
 [javac] return clone(obj, new IdentityHashMap(), broker);
 [javac]   ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\ReflectiveObjec
 tCopyStrategy.java:108: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: class
 org.apache.ojb.otm.copy.ReflectiveObjectCopyStrategy
 
 [javac] return clone(toCopy, new IdentityHashMap(), new
 HashMap(
 ));
 [javac]  ^
 [javac] 4 errors
 
 BUILD FAILED
 file:C:/db-ojb-1.0.rc4/build.xml:218: Compile failed; see the compiler error
 out
 put for details.
 
 Total time: 1 minute 9 seconds
 
 
 
__
Daniel B. Brown | WELLS FARGO BANK MINNESOTA, N.A. |
Software Architect | http://www.wellsfargo.com  | MAC N2702-011 | 
9062 Old Annapolis Road | Columbia | MD | 21045-1951 | 
p: 410.884.2034 | f: 410.715.2325 | [EMAIL PROTECTED]
|

 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED

RE: Compile for JDK 1.3?

2003-08-14 Thread Ron Gallagher
There's another jdk 1.3 compile problem related to the recent changes to
FieldDescriptor:

preprocess:
 [echo] using switches: +JDK13, -JDBC30
 [java]


main:
[javac] Compiling 502 source files to
C:\temp\OpenSource\db-ojb\target\classes
[javac]
C:\temp\OpenSource\db-ojb\target\src\org\apache\ojb\broker\metadata\FieldDes
criptor.java:218: cannot resolve  symbol
[javac] symbol  : variable BOOLEAN
[javac] location: class java.sql.Types
[javac] result = Types.BOOLEAN;
[javac]   ^
[javac] 1 error

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 09, 2003 11:58 AM
To: OJB Users List
Subject: Re: Compile for JDK 1.3?


Hi Daniel,

It's a slip with the RC4 releas. we normally provide build compatibility
for jdk 1.2, 1.3 and 1.4.
You can either use JDK 1.4
or remove the source package o.a.ojb.otm to work around this issue.
Will be fixed with next public release.

cheers,
Thomas

[EMAIL PROTECTED] wrote:
 I am following the quickstart.html directions and trying to run bin\build
 junit using JDK 1.3.1.  It looks like a targeted effort was made to get
 this work with JDKs other than 1.4.  However, the compile fails due to a
 dependency on a JDK 1.4 class.  Is this a bug? or must we use JDK 1.4 or
 better.

 The stack trace is as follows:

 C:\db-ojb-1.0.rc4bin\build junit
 Buildfile: build.xml

 splash:

 set-archive-name:

 set-archive-name-date:

 detect-jdk:

 check-jdk12proxy-classes:

 check-jndi-classes:

 use-jdk12:

 use-jdk13:
  [echo] detected JDK 1.3

 use-jdk14:

 init:

 prepare:
  [copy] Copying 586 files to C:\db-ojb-1.0.rc4\target\src
  [copy] Copying 259 files to C:\db-ojb-1.0.rc4\target\srctest
  [copy] Copying 10 files to C:\db-ojb-1.0.rc4\target\srcjca

 check-j2ee-classes:

 preprocess:
  [echo] using switches: +JDK13, -JDBC30
  [java]
 


 


 


 


 


 


 
 .
  [java]
 


 


 
 ...

 main:
 [javac] Compiling 549 source files to C:\db-ojb-1.0.rc4\target\classes
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\MetadataObjectC
 opyStrategy.java:69: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: package util
 [javac] import java.util.IdentityHashMap;
 [javac]  ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\ReflectiveObjec
 tCopyStrategy.java:68: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: package util
 [javac] import java.util.IdentityHashMap;
 [javac]  ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\MetadataObjectC
 opyStrategy.java:100: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: class
 org.apache.ojb.otm.copy.MetadataObjectCopyStrategy
 [javac] return clone(obj, new IdentityHashMap(), broker);
 [javac]   ^
 [javac]
 C:\db-ojb-1.0.rc4\target\src\org\apache\ojb\otm\copy\ReflectiveObjec
 tCopyStrategy.java:108: cannot resolve symbol
 [javac] symbol  : class IdentityHashMap
 [javac] location: class
 org.apache.ojb.otm.copy.ReflectiveObjectCopyStrategy

 [javac] return clone(toCopy, new IdentityHashMap(), new
 HashMap(
 ));
 [javac]  ^
 [javac] 4 errors

 BUILD FAILED
 file:C:/db-ojb-1.0.rc4/build.xml:218: Compile failed; see the compiler
error
 out
 put for details.

 Total time: 1 minute 9 seconds



__
Daniel B. Brown | WELLS FARGO BANK MINNESOTA, N.A. |
Software Architect | http://www.wellsfargo.com  | MAC N2702-011 |
9062 Old Annapolis Road | Columbia | MD | 21045-1951 |
p: 410.884.2034 | f: 410.715.2325 | [EMAIL PROTECTED]
|



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

Re: PROBLEM: same table name in different databases

2003-08-09 Thread Ron Gallagher
Julisys --

I had the same problem myself.  The solution is to simply set the schema attribute on 
the two class-descriptors.  This will cause ojb to treat those class-descriptors 
separately.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: JUliSys [EMAIL PROTECTED]
 Date: 2003/08/08 Fri AM 05:55:46 EDT
 To: [EMAIL PROTECTED]
 Subject: PROBLEM: same table name in different databases
 
 Hi all,
 
 I have a problem using the PersistanceBroker API in ojb-1.0.rc4.
 
 I tried to reduce the problem to a simple example as follows:
 
 I'm using two different databases. From one database (db-source) I'm 
 reading data, then I process it in some way before I store it in the 
 second database (db-dest).
 
 The data in db-source is stored in a table with the same name as in 
 db-dest (example: person), but the format is different (example: 
 birthday in db-source, but age in db-dest).
 
 The person in db-source is mapped (see repository.xml below) to the 
 class ojbtest.PersonSource and the person in db-dest is mapped to the 
 class ojbtest.PersonDest. These classes are implemented as simple as it 
 would be expected.
 
 When I try to read one PersonDest from db-dest, ojb assembles an SQL 
 command (see below) that tries to read also fields (A0.birthday) from 
 PersonSource which are not defined in PersonDest.
 
 My questions:
 - Is there a way that ojb allows the same table name
in multiple different databases?
 - Is this an error in ojb or am I doing something wrong?
 
 TIA
 julisys
 
 
 
 This is the SQL command that is assembled by ojb:
 
 SELECT A0.age,A0.name,A0.id,A0.birthday
FROM person A0
WHERE A0.id =  ?
 
 
 Here comes the repository.xml:
 
 
 ?xml version=1.0 encoding=iso-8859-1?
 !DOCTYPE descriptor-repository PUBLIC
 -//Apache Software Foundation//DTD OJB Repository//EN
 repository.dtd
 [
 !ENTITY internal SYSTEM repository_internal.xml
 ]
 
 
 descriptor-repository version=1.0 isolation-level=read-uncommitted
jdbc-connection-descriptor jcd-alias=db-source
  default-connection=false platform=Sapdb jdbc-level=3.0
  driver=com.sap.dbtech.jdbc.DriverSapDB
  protocol=jdbc subprotocol=sapdb dbalias=//teapp/calendar
  username=mm password=mm
  eager-release=false batch-mode=false
  useAutoCommit=1 ignoreAutoCommitExceptions=false
connection-pool maxActive=21 validationQuery= /
/jdbc-connection-descriptor
 
jdbc-connection-descriptor jcd-alias=db-dest
   default-connection=true platform=Sapdb jdbc-level=3.0
   driver=com.sap.dbtech.jdbc.DriverSapDB
   protocol=jdbc subprotocol=sapdb dbalias=//teapp/newsdev
   username=news password=news
   eager-release=false batch-mode=false
   useAutoCommit=1 ignoreAutoCommitExceptions=false
connection-pool maxActive=21 validationQuery= /
/jdbc-connection-descriptor
 
internal;
 
class-descriptor class=ojbtest.PersonSource table=person
field-descriptor name=id column=id jdbc-type=INTEGER
  primarykey=true autoincrement=true/
field-descriptor name=name column=name jdbc-type=INTEGER/
field-descriptor name=birthday column=birthday
  jdbc-type=DATE/
/class-descriptor
 
class-descriptor class=ojbtest.PersonDest table=person
field-descriptor name=id column=id jdbc-type=INTEGER
  primarykey=true autoincrement=true/
field-descriptor name=name column=name jdbc-type=INTEGER/
field-descriptor name=age column=age jdbc-type=INTEGER/
/class-descriptor
 /descriptor-repository
 
 
 
 
 And this is the code that reads a PersonSource from db-source:
 
 
 package ojbtest;
 
 import org.apache.ojb.broker.*;
 import org.apache.ojb.broker.query.*;
 
 import java.util.Iterator;
 
 public class OjbTest {
  public static void main(String[] args) {
  PBKey pbKey;
  PersistenceBroker persistenceBroker;
  Query query;
  Iterator iterator;
 
  try {
  pbKey = new PBKey(db-dest);
  persistenceBroker = 
 PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  Criteria criteria = new Criteria();
  criteria.addEqualTo(id, new Integer(1));
  query = new QueryByCriteria(PersonDest.class, criteria);
  iterator = persistenceBroker.getIteratorByQuery(query);
  if (iterator.hasNext()) {
  PersonDest person = (PersonDest) iterator.next();
  System.out.println(person);
  }
  persistenceBroker.close

Re: Problems with getObjectByIdentity

2003-08-04 Thread Ron Gallagher
Norival --

Make sure you're using the latest version of OJB.properties from cvs.  There is a new 
configuration setting for StatementsForClassClass that is not present in the 
OJB.properties file that you are using.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-Original Message-
From: Norival Neri Junior [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 4:18 PM
To: [EMAIL PROTECTED]
Subject: Problems with getObjectByIdentity


Hi all,

I am trying to run a ojb hello world but the method getObjectByIdentity doesnt 
work because the error happens:

org.apache.ojb.broker.PersistenceBrokerException: ConfigurableFactory configuration 
key class for key'StatementsForClassClass' does not exist.
 at org.apache.ojb.broker.util.factory.ConfigurableFactory.configure(Unknown Source)
 at org.apache.ojb.broker.util.configuration.impl.OjbConfigurator.configure(Unknown 
Source)
 at org.apache.ojb.broker.util.factory.ConfigurableFactory.init(Unknown Source)
 at org.apache.ojb.broker.accesslayer.StatementsForClassFactory.init(Unknown Source)
   

snip


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



Re: newbie question

2003-08-04 Thread Ron Gallagher
Anthony --

There are two versions of the store method provided by the PersistenceBroker

store(Object)
store(Object,ObjectModification)

It appears that you're using the first version.  In this case, ojb will first do a 
select against your db to see if the record exists.  If it does, then ojb will do an 
update.  If it doesn't, then ojb will do an insert.

To force ojb to do an insert or an update, use the second version of the store method 
and pass either org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT or 
org.apache.ojb.broker.util.ObjectModificationDefaultImpl#UPDATE.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Anthony E. Carlos [EMAIL PROTECTED]
 Date: 2003/08/04 Mon PM 04:47:19 EDT
 To: [EMAIL PROTECTED]
 Subject: newbie question
 
 Hello all,
 
 I'm using the PB API and can store a simple object to a table. Even 
 though table has a primary key constraint on the id column, if I try to 
 store a different object with the same id, there is no primary key 
 constraint violation. In fact, OJB _UPDATES_ the existing matching row 
 in the database, instead of trying to INSERT a new row (which would 
 trigger the integrity constraint). I'm using Oracle 8i.
 
 My question, therefore, is:
 
 Do I have to perform my own referential integrity checks when I use 
 OJB? Am I missing a basic idea behind OJB (like the lack of a need for 
 referential integrity)?
 
 I've searched the mail archives and the online docs, but can't find the 
 answer to these simple questions.
 
 Thanks,
 
 Anthony Carlos
 
 
 -
 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: Re: Query

2003-07-28 Thread Ron Gallagher
Cesar -- 

The join is taken care of for you by ojb:

Criteria criteria = new Criteria()
criteria.addEqualTo(referenceToBClass,YourValueGoesHere);
Query query = new QueryByCriteria(MyClass,criteria);
PersistenceBroker broker = getPersistenceBroker();
Object object = broker.getObjectByQuery(query);

This example assumes that the class-descriptor for 'MyClass' includes a 
reference-descriptor whose name is 'referenceToBClass'

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]
 
 From: Cesar [EMAIL PROTECTED]
 Date: 2003/07/28 Mon PM 04:55:28 EDT
 To: OJB Users List [EMAIL PROTECTED]
 Subject: Re: Query
 
 And How i use the join?( where a.idt=b.idt and)
 
 [ ]´s
 - Original Message -
 From: Leandro Rodrigo Saad Cruz [EMAIL PROTECTED]
 To: OJB Users List [EMAIL PROTECTED]
 Sent: Monday, July 28, 2003 5:03 PM
 Subject: Re: Query
 
 
 Using QueryByCriteria !
 
 On Mon, 2003-07-28 at 16:51, Cesar wrote:
  People
  I have one query
 
  SQL = select a.idt, a.desc from table1 a, table2 b where a.idt=b.idt and
  b.idUser=?
 
  I need execute this query to recover one object, but i can´t set the bind
  variable using the code below
 
  Query query = QueryFactory.newQuery(MyClass,Queries.SQL);
   PersistenceBroker broker = getPersistenceBroker();
   Object object = broker.getObjectByQuery(query);
broker.close();
   return object;
 
  How I make to set the bind variable?
 
  [ ]´s
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 --
 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]
 
 
 -
 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: Urgent: Example for Report Query

2003-07-21 Thread Ron Gallagher
Aaron --

This should create the query you need.

String fields[] = new String[]{
/* 0 */ Name,
/* 1 */ avg(Performances.Payout),
/* 2 */ avg(Performances.Attendance),
/* 3 */ ContactPerson,
/* 4 */ ContactPhone};

// Assemble the criteria.
Criteria criteria = new Criteria();
criteria.addGroupBy(fields[0]);
criteria.addGroupBy(fields[3]);
criteria.addGroupBy(fields[4]);
criteria.addOrderByAscending(avg(Performances.Attendance));

// Assemble the query.
ReportQueryByCriteria query =
new ReportQueryByCriteria(
Band.class,
fields,
criteria);

Then, just use the getCollectionByQuery method on the PB to get the results.

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


 
 From: Aaron Longwell [EMAIL PROTECTED]
 Date: 2003/07/21 Mon AM 11:53:46 EDT
 To: OJB User [EMAIL PROTECTED]
 Subject: Urgent: Example for Report Query
 
 I cannot figure out how to do a report query. Here's my set up:
 
 Class: Band
 Fields: Name, ContactPerson, ContactPhone
 Collection: Performances
 
 Class: Performance
 Fields: Payout, Attendance
 
 I need to do a report query that will give me 5 columns: Band.Name, 
 Band.ContactPerson, Band.ContactPhone, Avg(Performance.Payout), 
 Avg(Performance.Attendance).
 
 I then need to order by Name, Attendance or Payout based on the user's 
 selection.
 
 In real SQL it would look something like this:
 
 SELECT Band.Name, AVG(Performance.Payout) As Payout,  
 AVG(Performance.Attendance) As Attendace, Band.ContactPerson, 
 Band.ContactPhone
 
 FROM Band
 
 INNER JOIN Performance ON Performance.BandID = Band.ID
 
 GROUP BY Band.Name, Band.ContactPerson, Band.ContactPhone
 ORDER BY Attendance ASC
 
 I have been thoroughly impressed with the quality of the OJB product, 
 but I have had the hardest time learning how to use it using only the 
 online documentation. I am willing to help out with documentation 
 writing of examples to answer questions like mine above.
 
 Thank you for your time,
 Aaron Longwell
 
 
 
 -
 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: complex SQL

2003-07-16 Thread Ron Gallagher
Take a look at the methods setStartAtIndex and setEndAtIndex as defined in the 
org.apache.ojb.broker.query.Query interface.  I believe this is what you're looking 
for.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


 
 From: Lopez Vellon, Ignacio [EMAIL PROTECTED]
 Date: 2003/07/16 Wed PM 12:35:43 EDT
 To: [EMAIL PROTECTED]
 Subject: complex SQL
 
 I am using OJB for a month without any problem , but today i wanted execute 
 something like
 this :
 
   select * FROM 
   
   (SELECT rownum numFile, A0.MS_NB_USUARIO_ALTA
  FROM OPENCOWNER.CRM_V_EXPEDIENTE A0 
WHERE A0.MS_NB_USUARIO_ALTA = '1') 
 
   WHERE numFile = '5' AND numFile = '15'
 
 and i do not know how do it, i read the documentation and I did not find a solution
 
 I am using Oracle 9i database .
 
   does anyone know how to do it ?
 
   thank you.
 
 -
 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: Optimization advice/help.

2003-07-10 Thread Ron Gallagher
Josh -- 

My response is based on the following assumptions:

1) the 'weight' is defined as a property on the CarAddedParts class
2) The list of invoices that a customer has is provided by the 'invoices' property
3) The list of cars that are included on an invoice is provided by the 'cars' property
4) The list of additional parts for a car is provided by the 'additionalParts' property
5) All of the 'lists' in 2-4 are defined in your repository.

If those assumptions are correct, then the following will do what you're looking for.

PersistenceBroker broker = ...;
Criteria criteria = new Criteria();
criteria.addEqualTo(customerId, new Long(1));
ReportQueryByCriteria query =
new ReportQueryByCriteria(
Customer.class,
new String[]{sum(invoices.cars.additionalParts.weight)},
criteria);
Iterator iterator = broker.getReportQueryIteratorByQuery(query);
while (iterator.hasNext()) {
Object[] data = (Object[]) iterator.next();
// the sum will be in data[0]
}
if ((iterator != null)  (iterator instanceof OJBIterator)) {
OJBIterator ojbIterator = (OJBIterator) iterator;
ojbIterator.releaseDbResources();
}

Please note...both the compiler and unit tester on my email client are not working 
today, so there may be some syntax errors.  

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Josh Berry [EMAIL PROTECTED]
 Date: 2003/07/10 Thu PM 12:30:29 EDT
 To: [EMAIL PROTECTED]
 Subject: Optimization advice/help.
 
 I don't want this to just be a performance question, but I must admit that
 that is at the heart of my problem.
 
 First, a little background on my problem.  I will try to work this into a
 standard shopping cart/customer problem, but it may prove difficult.
 
 So...  Lets say I have the following classes:
 
   *Customer
  A person buying a car.  Obviously many of these exist.
   *Invoice
  An individual record of a single customer buying one or more cars.
  Many of these can exist per customer.
   *CarInfo
  A total breakdown of a vehicle to be ordered. 
   *CarMakeInfo
  Basic information on a broad category of vehicle. (e.g. Ford Mustang)
   *CarModelInfo
  Specific information on a vehicle. 
  (e.g. 4.0 liter engine, manual locks, dimensions, etc.) 
   *CarCustomizationsInfo
  Any special changes that a customer requested for the vehicle.
  This is basically a set of overrides to CarModelInfo.  So, either
  it exists or it does not.
  (e.g. Dimensions changed due to added roof lights, 
power locks added.)
   *CarAddedParts
  Any of a number of additional items to be added to the vehicle.
  (e.g. the roof lights )
 
 
 Now... I believe these will be all that is needed.
 
 The relationships are as follows.
 
   Customer has a 1:M with Invoice.
   Invoice has a 1:M with CarInfo.
   CarInfo has a 1:1 with CarMakeInfo.
   CarInfo has a 1:1 with CarModelInfo.
   CarInfo has a 1:1 with CarCustomizationsInfo.
   CarInfo has a 1:M with CarAddedPartsInfo.
 
 
 So, the problem I have is this:  
 
 We currently do reports where we need to know the total weight of everything a
 customer has ever ordered.  Now, it is clean code with OJB, as I can just loop
 through all of a customer's invoices calling getWeight for every CarInfo. 
 However, this has performed abysmally slowly.
 
 Now, my guess is that OJB does one select to get all of the Invoices.  Then,
 it will do another select per Invoice to get all of the CarInfos.
 Then, for each CarInfo, it will do 3 selects to get each of CarMakeInfo,
 CarModelInfo, and CarCustomizationsInfo.
 In addition, it will do another select per CarInfo to get CarAddedPartsInfo.
 
 For a single customer with X invoices averaging Y CarInfos that have on
 average Z CarAddedParts, this yields approximately 1 + X + (4 * Y) selects. 
 Obviously, this is a lot of selects to happen once you start doing this over
 many Invoices that have many CarInfos with lots of AddedParts.  And when my
 numbers average to something like 1000 invoices with about 80 parts a piece,
 this starts getting out of hand quickly.
 
 So, the problem I am facing is I do not know a way to avoid all of these
 selects with OJB.  Writing it on my own, I am able to reduce the number down
 to a fixed 4 selects.  I could probably widdle it down more, but I would
 prefer some maintainability of the code, which is why I would like to keep
 OJB.  Does anyone know of any tricks?  
 
 Basically, I think my problem is when you have a M:N:O relationship that needs
 to be looped through.  (Also note: in the actual problem I have, I have
 several of these relationships in existance.  Think of it as though I had
 seperate cases for Cars and Trucks, with a few differences between them.)
 
 Finally, I thank anyone who had the patience to read through this example

Re: Where Do Stored Procedures Fit Into An O/R Mapping Layer?

2003-07-08 Thread Ron Gallagher
Burt -- 

When I first approached Thomas regarding what I wanted to accomplish, we both agreed 
that my implementation did not fit well into the 'core' OJB api.  However, we agreed 
to implement some new features and enhance some existing ones to enable me to 
extend/customize OJB to support my needs.  I'm not sure if that view point has 
changed.  Thomas may be able to comment further.

With respect to the specific changes you mention, here are my explanations:

I had to extend org.apache.ojb.broker.accesslayer.StatementsForClassImpl because this 
was where the JDBC statement is created that will be used to perform the 
insert/update/delete operation.  Out of the box, this class creates a 
PreparedStatement.  In my situation, I needed it to create a CallableStatement so that 
I could 'harvest' values that were returned by the stored procedure.  So, my change 
was to simply replicate the code in prepareStatement(Connection, String, boolean) and 
change con.prepareStatement to con.prepareCall.

I had to override getStatementsForClass(ClassDescriptor) because the implementation 
provided by org.apache.ojb.broker.accesslayer.StatementManager instantiated the 
StatementsForClassImpl class, not my extension (above).

I believe that somewhere in my dialogs with Thomas, we discussed the possibility of 
making the first situation 'pluggable' so that neither of these extensions would be 
required.  Maybe some sort of 'StatementFactory' implementation.  I don't recall 
exactly where those discussions went.  Maybe it's time to reconsider the option since 
others are starting to use stored procedures.

Those are my thoughts.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: BURT, RANDALL (CONTRACTOR) [EMAIL PROTECTED]
 Date: 2003/07/08 Tue AM 10:19:27 EDT
 To: OJB Users List [EMAIL PROTECTED]
 Subject: RE: Where Do Stored Procedures Fit Into An O/R Mapping Layer?
 
 The project I'm on has come to the point of integrating sp's into the app, and I was 
 wondering if there were any plans to incorporate Mr. Gallagher's ideas into the main 
 OJB distribution. If so, I'd be more than willing to lend a hand. 
 
 Also, maybe its my ignorance, but could you expand on the modifications you had to 
 make in org.apache.ojb.broker.accesslayer.StatementsForClassImpl and 
 org.apache.ojb.broker.accesslayer.StatementManager.getStatementsForClass(ClassDescriptor)?
  My (admittedly very limited) understanding of these classes doesn't clue me as to 
 the reason/form of the modifications.
 
 Thanks, BTW, to Mr. Gallagher, Mr. Mahler, and the rest of the OJB team for a great 
 framework and documentation.



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



Re: attribute element in field-desciptor

2003-06-26 Thread Ron Gallagher
Joerg --

The attribute element allows you to add any sort of attribute without having to first 
modify the dtd.  They allow users to implement enhancements that shouldn't be part of 
the core ojb api.  I use them extensively on my current project to allow me to use 
Oracle packages to handle all insert, update and delete operations.  Details of how 
we're doing this can be found 
xdocs/how-to-work-with-stored-procedures.xml.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]


 
 From: Joerg Lensing [EMAIL PROTECTED]
 Date: 2003/06/26 Thu AM 04:56:10 EDT
 To: OJB Users List [EMAIL PROTECTED]
 Subject: attribute element in field-desciptor
 
 hello,
 can someone tell me the purpose of the attribute element in 
 field-descriptor? the docs are very
 short about this and the testcases don't show an example.
 
 joerg
 
 
 -
 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: RE: Default Cache - bug? design catostrophe? user error?

2003-04-02 Thread Ron Gallagher
David --

Have you tried setting refresh=true for the reference-descriptor?  If this is set, 
then when you retrieve object A, the reference to B will be refreshed.  Based on the 
code that I reviewed, this refresh happens both when A is initially retrieved from the 
database and when it's pulled from the cache.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: [EMAIL PROTECTED]
 Date: 2003/04/02 Wed AM 08:11:15 EST
 To: OJB Users List [EMAIL PROTECTED]
 CC: 'OJB Users List' [EMAIL PROTECTED]
 Subject: RE: Default Cache -  bug?  design catostrophe?  user error?
 
 
 It's not the transaction isolation that's a concern.  I think the
 PerBrokerCache has the same problem, which is that directly or indirectly,
 the cache contains an invalid representation of what's in the database,
 while there are no transactions in progress.
 
 
 
 
 |-+
 | |   Mahler Thomas|
 | |   [EMAIL PROTECTED]|
 | |   ellium.com  |
 | ||
 | |   04/02/2003 02:22 |
 | |   AM   |
 | |   Please respond to|
 | |   OJB Users List |
 | ||
 |-+
   
 --|
   |  
 |
   |To:  'OJB Users List' [EMAIL PROTECTED]   
|
   |cc:   
 |
   |Subject: RE: Default Cache -  bug?  design catostrophe?  user error?  
 |
   |  
 |
   
 --|
 
 
 
 The DefaultCache is a global cache that does not isolate broker
 transactions.
 You can use other cache implementations (like the PerBrokerCache) that
 isolate transactions.
 
 We hope get those issues fixed till 1.0
 
 Thomas
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, April 01, 2003 9:28 PM
  To: OJB Users List
  Cc: OJB Users List
  Subject: RE: Default Cache - bug? design catostrophe? user error?
 
 
 
  Well, that DOES work, but in a multi-user environment, I
  would consider
  this fairly drastic.  Of course, if my other option is to not
  have a cache
  at all
 
 
 
 
 
  |-+---
  | |   Scott Howlett |
  | |   [EMAIL PROTECTED]|
  | |   .com   |
  | |   |
  | |   04/01/2003 01:40|
  | |   PM  |
  | |   Please respond  |
  | |   to OJB Users   |
  | |   List   |
  | |   |
  |-+---
 
  -
  --
  ---|
|
 
   |
|To:  OJB Users List [EMAIL PROTECTED]
 
   |
|cc:
 
   |
|Subject: RE: Default Cache -  bug?  design
  catostrophe?  user error?
   |
|
 
   |
 
  -
  --
  ---|
 
 
 
  Could you flush the cache whenever you rollback a transaction?
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, April 01, 2003 1:37 PM
  To: [EMAIL PROTECTED]
  Subject: Default Cache - bug? design catostrophe? user error?
 
 
  Consider this: I'm uing ObjectCacheDefaultImpl
 
  1) I have an A which contains (has a reference to) a B.
  2) B has a name property.
  3) When I load A (oid=1), B(oid=2) gets loaded.
  4) Now the cache looks like this { A(1)[B(2)], B(2) } ( A is in the
  cache, and refers to B.  B is in the cache).
  5) I begin a transaction, and lock B(2) into it so I can change it's
  name.
  6) I change it's name.
  7) Something happens, and the transaction is rolled back.
  8) B gets flushed from the cache, because the name it has is now
  invalid

RE: Default Cache - bug? design catostrophe? user error?

2003-04-02 Thread Ron Gallagher
David --

It's not used by the cache.  It's used by the PersistenceBroker when it retrieves an 
object.  If the 'target' object is found in the cache, then any reference/collection 
descriptors that are marked with refresh=true are re-populated before the 'target' 
is returned to the caller.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: [EMAIL PROTECTED]
 Date: 2003/04/02 Wed AM 11:44:27 EST
 To: OJB Users List [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: Re: RE: Default Cache -  bug?  design catostrophe?  user error?
 
 
 No, I haven't.  I will take a look at that, but the code I saw in the cache
 didn't look like it would do that



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



Re: new to the api and have a question

2003-03-30 Thread Ron Gallagher
 Hello all,
 
 I'm new as of today, to this api.
 
 I sat down Friday to write one ;) and then though someone else must have
 tried this already... and here it is!
 
 Anyway, I'm going through the documentation now, but I wanted to know if its
 possible to make an object immutable... for instance, I've got a country
 list and the data doesn't change, and I want to make sure that one of my
 developers can't alter the table (particularly in the production env).
 Currently in my own design I'm using a fairly simple JavaBean system, and a
 factory behind the beans... this allows the factory to throw a veto
 exception if the data is immutable and someone tried to change it. Does
 anything like that exist in this API?

Have you looked at the PersistenceBrokerListener interface?  It includes a beforeStore 
method that's invoked before any object is persisted.  When beforeStore method is 
invoked, you just look at the object that's being stored.  If it's a 'country' object, 
simply throw an exception and the storage opertion will be aborted.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]



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



Re: Fields are merged if two DB connections are used

2003-03-26 Thread Ron Gallagher
Thomas -- 

You need to set the schema attribute on the class-descriptors.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Thomas Fahrmeyer [EMAIL PROTECTED]
 Date: 2003/03/26 Wed AM 04:02:46 EST
 To: [EMAIL PROTECTED]
 Subject: Fields are merged if two DB connections are used
 
 I have a problem. I try to connect to two different databases (oracle
 and mysql) and want to retrieve data from
 a table that is given in both of them. Although the table has the same
 name in both databases, there are
 different fields. Contrary to sanity the generated query for one table
 does use the columns of both tables.
 
 Java Code:
 PersistenceBroker broker = getBroker(database1);
 
 UTable1 utable1 = new UTable1();
 
 Collection coll =
 broker.getCollectionByQuery(QueryFactory.newQuery(utable1)); // Here is
 the wrong query because fields of both tables have merged
 
 Iterator iter = coll.iterator();
 while(iter.hasNext()) {
UTable1 ut1 = (UTable1)iter.next();
cat.debug(UTable1:  + ut1.getName());
 }
 broker.close();
 
 
 
 broker = getBroker(database2);
 
 UTable2 utable2 = new UTable2();
 
 coll = broker.getCollectionByQuery(QueryFactory.newQuery(utable2)); //
 Still a wrong query
 
 iter = coll.iterator();
 while(iter.hasNext()) {
UTable2 ut2 = (UTable2)iter.next();
System.out.println(UTable2:  + ut2.getName());
 }
 broker.close();
 
 
 
 repository_database1.xml:
 class-descriptor
  class=UTable1
table=user
 
 !-- This field is not in the other user table --
 field-descriptor id=1
   name=usId
   column=us_id
   jdbc-type=VARCHAR
   nullable=false
   primarykey=true
/
 
field-descriptor id=2
   name=usName
   column=us_name
   jdbc-type=VARCHAR
/
 /class-descriptor
 
 
 
 
 repository_database2.xml:
 class-descriptor
  class=UTable2
table=user
 
 !-- This field is not in the other user table --
 field-descriptor id=1
   name=usFields
   column=us_fields
   jdbc-type=VARCHAR
   nullable=false
   primarykey=true
/
 
field-descriptor id=2
   name=usName
   column=us_name
   jdbc-type=VARCHAR
/
 /class-descriptor
 
 
 
 user table in database1 does only have the fields us_id and us_name.
 user table in database2 does only have the fields us_fields and us_name.
 
 
 
 
 
 The generated query:
 SELECT A0.us_name,A0.us_id,A0.us_fields FROM user A0
 
 As you can see the fields have mergedWHY?
 
 BTW OJB is cool stuff and really worth to be used ;) Keep on working.
 
 Thanx in advance
 Thomas
 
 
 -
 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: Using setStartAtIndex with Oracle 8i

2003-03-25 Thread Ron Gallagher
Patrick -- 

You can use it with oracle 8i.  Just set the jdbc level in the connection descriptor 
you're using to 2.0 or greater.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Patrick Prodhon [EMAIL PROTECTED]
 Date: 2003/03/25 Tue AM 08:11:05 EST
 To: [EMAIL PROTECTED]
 Subject: Using setStartAtIndex with Oracle 8i
 
 Hello OJB world,
 
 We are currently facing some performance problems on our project, and we'd
 like to be able to use setStartAtIndex and setEndAtIndex with Oracle 8i.
 Yet, it seems that when we try and use it, it won't work. I get these
 [org.apache.ojb.broker.accesslayer.SqlBasedRsIterator] INFO: Your driver
 does not support advanced JDBC Functionality, you cannot call size()
 messages, which don't sound friendly at all : does this mean I can't use
 this functionnality with Oracle 8i ? Has anyone been able to use it ? If so,
 how ?
 We're using Oracle's driver (classes12.jar).
 
 Thanks.
 Patrick.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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



Re: problem with join across 1:n relationships

2003-03-12 Thread Ron Gallagher
Lorna -- 

Looks like a problem with case sensitivity.

Change

crit.addEqualTo(ExternalEntity.database_id, databaseId );

to

crit.addEqualTo(externalEntity.database_id, databaseId );

and things will probably work better.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Lorna Morris [EMAIL PROTECTED]
 Date: 2003/03/12 Wed AM 11:37:08 EST
 To: [EMAIL PROTECTED]
 Subject: problem with join across 1:n relationships
 
 Hi,
 
 I am having problems doing queries with joins. Maybe it's because I'm
 using ojb0.9.2. I really must upgrade soon. I have been reading the
 section on joins in the documentation here:
 http://db.apache.org/ojb/query.html, but this may not apply to ojb0.9.2
 and I can't find anything in the mailing list archives.
 
 The problem is when I use QueryByCriteria to perform a query that joins
 2 tables, I get some unexpected sql generated.
 
 I am doing a query by crieria, selecting objects from one table
 (reference) by a single value in a column of an associated table
 (external_entity). There is a 1-M association between
 external_entity:reference. Here is the snippet of java that performs the
 query and the class descriptors from the repository.xml for the two
 relevant classes:
 
 
 String databaseId = A1234;
 Criteria crit = new Criteria();
 crit.addEqualTo(ExternalEntity.database_id, databaseId );
 Query query = new QueryByCriteria( Reference.class, crit );
 Collection col = broker.getCollectionByQuery(query);
 
 
 !-- Definitions for uk.ac.ebi.integr8.data.Reference--
 class-descriptor
 class=uk.ac.ebi.integr8.data.Reference
 table=REFERENCE
 
 field-descriptor id=1
 name=referenceId
 column=REFERENCE_ID
 jdbc-type=BIGINT
 primarykey=true
 autoincrement=true
 /
 field-descriptor id=2
 name=externalEntityId
 column=EXTERNAL_ENTITY_ID
 jdbc-type=BIGINT
 /
 reference-descriptor
 name=externalEntity
 class-ref=uk.ac.ebi.integr8.data.ExternalEntity
 
 foreignkey field-id-ref=2/
 /reference-descriptor
 /class-descriptor
 
 
!-- Definitions for uk.ac.ebi.integr8.data.ExternalEntity --
 class-descriptor
 class=uk.ac.ebi.integr8.data.ExternalEntity
 table=EXTERNAL_ENTITY
 
 field-descriptor id=1
 name=externalEntityId
 column=EXTERNAL_ENTITY_ID
 jdbc-type=BIGINT
 primarykey=true
 autoincrement=true
 /
 field-descriptor id=2
 name=db_id
 column=DATABASE_ID
 jdbc-type=VARCHAR
 /
 collection-descriptor
 name=references
 element-class-ref=uk.ac.ebi.integr8.data.Reference
 auto-retrieve=false
 auto-update=false
 auto-delete=false
 proxy=false
 
 inverse-foreignkey field-id-ref=2/
 /collection-descriptor
 /class-descriptor
 
 
 The query that is generated by ojb is:
 
 SELECT A0.REFERENCE_ID,A0.EXTERNAL_ENTITY_ID FROM REFERENCE A0 WHERE
 ExternalEntity.database_id = ?
 
 
 But I was hoping for a query of this form to be generated, i.e. ojb
 would perform the join based on the foreign key information in the
 repository.xml:
 
 SELECT A0.REFERENCE_ID,A0.EXTERNAL_ENTITY_ID FROM REFERENCE A0,
 EXTERNAL_ENTITY EE WHERE EE.EXTERNAL_ENTITY_ID = AO.EXTERNAL_ENTITY_ID
 AND EE.database_id = ?
 
 
 
 Any help would be greatly appreciated,
 
 Many thanks
 
 Lorna
 
 
 
 
 -
 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: Selecting Top 10 records??

2003-03-12 Thread Ron Gallagher
Try using

query.setStartAtIndex(0);
query.setEndAtIndex(10);

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: Ismail Siddiqui [EMAIL PROTECTED]
 Date: 2003/03/12 Wed PM 02:26:35 EST
 To: OJB Users List [EMAIL PROTECTED]
 Subject: Selecting Top 10  records??
 
 Hi all
 I am using QueryByCriteria  as following
 
 PersistenceBroker broker =
 PersistenceBrokerFactory.defaultPersistenceBroker();
   broker.beginTransaction();
   Criteria c = new Criteria();
   c.addEqualToColumn(program_instance_id, program_instance_id+);
   c.addOrderByDescending(score);
   QueryByCriteria query = new QueryByCriteria(Game.class, c);
 Collection game =
 broker.getCollectionByQuery(query);
 
 I am running microsoft sql server and want to select only top 5 records
 ..like select top 5  * where   How can I put this condition in Criteria
 
 
 Thanks
 
 ismail
 
 
 -
 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: Why is OJB inserting null on one field?

2003-03-04 Thread Ron Gallagher
The issue isn't the presence of the record in the table.  It's the presence on the 
newImport of an Lu_process_status object which represents the Q record in the 
database.

When you store newImport, ojb looks at the content of newImport to figure out what 
values to use in the sql statement.  In this situation, ojb looks at the contents of 
the lu_process_status field.  If that field contains a null reference, then ojb will 
use a null value for imports.status_id.  If the lu_process_status field contains an 
actual object reference, then the id of that reference will be used for 
imports.status_id.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: C F [EMAIL PROTECTED]
 Date: 2003/03/04 Tue PM 12:16:33 EST
 To: OJB Users List [EMAIL PROTECTED]
 Subject: Re: Why is OJB inserting null on one field?
 
 
 Thanks for the reply Ron.  I actually wondered if something like that was going on 
 and I tested that before sending the message.  The value *does* exist in that other 
 table
 select * from lu_process_status where id = 'Q';
  returns a record.  So if I understood your message correctly, that doesn't 
 appear to be the problem.  Any other ideas?  Thanks again for your help.
  Ron Gallagher [EMAIL PROTECTED] wrote:When OJB performs the insert/update, it 
 uses the value of id from the Lu_process_status object that's stored in the 
 lu_process_status field for the value of imports.status_id. If the field 
 lu_process_status is null when you ask ojb to store the object, then ojb will 
 populate imports.status_id with a null value.
 
 In your code, you're setting status_id on the newImport to Q. However, before 
 you store newImport, you need to ensure that the field lu_process_status 
 contains a reference to the object that represents a status of Q.
 
 Ron Gallagher
 Atlanta, GA
 [EMAIL PROTECTED]
 
 
  
  From: C F 
  Date: 2003/03/04 Tue AM 10:53:29 EST
  To: [EMAIL PROTECTED]
  Subject: Why is OJB inserting null on one field?
  
  
  Hello,
  
  I'm about 90% sure this problem started happening after I upgraded some stuff 
  (OJB, PostgreSQL and JDBC driver). What's happening is that for some reason, on 
  inserting, OJB seems to be inserting everything correctly except for my 
  'status_id' field and I have no idea why. Below, I have a code sample, the SQL 
  statement that is being received by the database and repository defs. Notice that 
  in the insert statement, the status_id field is null despite being explicitly set 
  by newImport.setStatus_id(Q)...
  
  Import newImport = new Import();
  newImport.setUser_id(user.getId());
  newImport.setFile_size(new BigDecimal(file.getFileSize()));
  newImport.setIn_file(file.getFileName());
  newImport.setOut_file(outFile.getName());
  newImport.setStatus_id(Q);
  try
  {
  tx = odmg.newTransaction();
  tx.begin();
  tx.lock(layerImport, tx.WRITE);
  tx.commit();
  }
  
  
  . the resulting SQL statement is
  
  INSERT INTO imports 
  (file_format,file_size,id,in_file,out_file,request_date,status_id,user_id) VALUES 
  ( null, 3100237, 21, 'Exports.zip', '0001_60784.zip', null, null, 1 )
  
  
  Object Defs
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  -
  
  There's nothing wrong with my 'Import' bean. After setting the Status_id, I can 
  System.out.println(newImport.getStatus_id()) just fine.
  
  I'm using OJB from CVS a few days ago (0.9.9+) and PostgreSQL 7.3.2 with their 
  JDBC 7.3 driver.
  
  Any ideas??
  
  Thanks!
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 Do you Yahoo!?
 Yahoo! Tax Center - forms, calculators, tips, and more
 


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



Re: Query returning denormalised view

2003-02-25 Thread Ron Gallagher
John -- 

Use this constructor when you create your query object:

QueryByCriteria(Class,Criteria,boolean)

Passing true for the 3rd argument causes the generated sql to include the DISTINCT 
keyword.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

 
 From: O'Reilly John [EMAIL PROTECTED]
 Date: 2003/02/25 Tue PM 01:20:25 EST
 To: 'OJB Users List' [EMAIL PROTECTED]
 Subject: Query returning denormalised view
 
 Hi,
 
 I'm having a problem whereby a query that involves searching for values in a
 contained collection returns the same number of objects as the collection.
 Take, for example the case of a member object that has a collection of
 addresses.  If I do the following query.
 
 crit.addLike(upper(name), %John Smith% );
 crit.addLike(upper(addresses.addressLine1), %1 High Street% ); //
 addressModel
 
 Query query = new QueryByCriteria(MemberModel.class, crit);
 listOfMembers = getBroker().getCollectionByQuery(query);
 
 The returned collection has as many objects as there are addresses (in my
 test case, I have a number of addresses (all the same) linked to the same
 member).  There should only be one member object which in turn contains a
 collection of addresses.
 
 BTW, I'm using version 0.9.9 with the addition of the patch mentioned below:
 http://www.mail-archive.com/[EMAIL PROTECTED]/msg00447.html
 
 The problem happens without the patch also.
 
 Regards,
 John



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