RE: how to manipulate many repository

2003-03-18 Thread Malinescu, Cristian
Yes, right ...

import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.PersistenceBrokerFactory;

...

PersistenceBroker myBroker =
PersistenceBrokerFactory.createPersistenceBroker( new PBKey( myPoolAlias)
);

...

that's all ...
regards,
Cristian


-Original Message-
From: TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 18. März 2003 14:18
To: 'OJB Users List'
Subject: how to manipulate many repository


Hi,

I want to handle many repository in the same projet. But the first parameter
of createPersistenceBroker(RepositoryFile, String, String) don't correspond
of the file name: it seems to correspond to jcd-alias. That right?

Houar

 -Message d'origine-
De :TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED] 
Envoyé :mardi 18 mars 2003 13:59
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Hi,

I use P6Spy to see generated sql at runtime.

Houar

 -Message d'origine-
De :Mahler Thomas [mailto:[EMAIL PROTECTED] 
Envoyé :lundi 17 mars 2003 17:46
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Mhh,

I don't know all API changes since 0.9.5 by heart, but the
SqlGeneratorFactory is really a very old piece of code.
have a look in the org.apache.ojb.broker.accesslayer.sql package

Maybe you can also instaiate SqlGenerator directly?!

cheers,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 17, 2003 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: RE: how to obtain the SQL code from a Query object?
 
 
 Thomas,
 
 Thanks for your help!
 
 How do you use this SqlGeneratorFactory. This class doesn't 
 seem to be in OJB 0.9.5.
 
 I think that I could migrate to 1.0 but I don't know what 
 exactly I will have to change in my code.
 
 Best.
 Sylvain
 
 -Message d'origine-
 De: Mahler Thomas [mailto:[EMAIL PROTECTED]
 Date: lundi, 17. mars 2003 16:12
 À: 'OJB Users List'
 Objet: RE: how to obtain the SQL code from a Query object?
 
 
 Hi Sylvain,
 
 I think so!
 But you can use the SqlGeneratorFactory to obtain a 
 SqlGenerator instance
 instead!
 
 cheers,
 Thomas
 
  -Original Message-
  From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 17, 2003 3:59 PM
  To: [EMAIL PROTECTED]
  Subject: RE: how to obtain the SQL code from a Query object?
  
  
  Hi Thomas,
  
  I can't find the broker.serviceSqlGenerator() method.
  
  I'm using OJB 0.9.5.
  Is it the problem?
  
  Thanks
  Sylvain
  
  
  
  -Message d'origine-
  De: Mahler Thomas [mailto:[EMAIL PROTECTED]
  Date: lundi, 17. mars 2003 10:59
  À: 'OJB Users List'
  Objet: RE: how to obtain the SQL code from a Query object?
  
  
  The Query object is not able to return SQL code, as it does 
  not have any
  platform specific know how.
  You have to ask the OJB SqlGenerator component to generate SQL:
  
  PersistenceBroker broker = ...
  Query query = ...;
  ClassDescriptor cld = ...;
  
  // obtain prepared stmt sql:
  String sql = 
  broker.serviceSqlGenerator().getPreparedSelectStatement(query,
  cld);
  
  // obtain no prepared sql: 
  sql = 
 broker.serviceSqlGenerator().getSelectStatementDep(query, cld);
  
  cheers,
  thomas
  
   -Original Message-
   From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]
   Sent: Monday, March 17, 2003 10:32 AM
   To: [EMAIL PROTECTED]
   Subject: how to obtain the SQL code from a Query object?
   
   
   Hello,
   
   I have this query:
   
   code
   Criteria crit = new Criteria();
   crit.addEqualTo(workstationName, U68111);
   
   Query query = new QueryByCriteria(Workstation.class, crit, true);
   code
   
   Is there a way to obtain the SQL query (select * from 
   Workstation where) from the query object?
   
   Thanks
   Sylvain
   
   
  
 -
   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]
 
 


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


RE : how to manipulate many repository

2003-03-18 Thread Emmanuel Dupont
Yes !


-Message d'origine-
De : TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 18 mars 2003 14:18
À : 'OJB Users List'
Objet : how to manipulate many repository

Hi,

I want to handle many repository in the same projet. But the first parameter
of createPersistenceBroker(RepositoryFile, String, String) don't correspond
of the file name: it seems to correspond to jcd-alias. That right?

Houar

 -Message d'origine-
De :TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED] 
Envoyé :mardi 18 mars 2003 13:59
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Hi,

I use P6Spy to see generated sql at runtime.

Houar

 -Message d'origine-
De :Mahler Thomas [mailto:[EMAIL PROTECTED] 
Envoyé :lundi 17 mars 2003 17:46
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Mhh,

I don't know all API changes since 0.9.5 by heart, but the
SqlGeneratorFactory is really a very old piece of code.
have a look in the org.apache.ojb.broker.accesslayer.sql package

Maybe you can also instaiate SqlGenerator directly?!

cheers,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 17, 2003 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: RE: how to obtain the SQL code from a Query object?
 
 
 Thomas,
 
 Thanks for your help!
 
 How do you use this SqlGeneratorFactory. This class doesn't 
 seem to be in OJB 0.9.5.
 
 I think that I could migrate to 1.0 but I don't know what 
 exactly I will have to change in my code.
 
 Best.
 Sylvain
 
 -Message d'origine-
 De: Mahler Thomas [mailto:[EMAIL PROTECTED]
 Date: lundi, 17. mars 2003 16:12
 À: 'OJB Users List'
 Objet: RE: how to obtain the SQL code from a Query object?
 
 
 Hi Sylvain,
 
 I think so!
 But you can use the SqlGeneratorFactory to obtain a 
 SqlGenerator instance
 instead!
 
 cheers,
 Thomas
 
  -Original Message-
  From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 17, 2003 3:59 PM
  To: [EMAIL PROTECTED]
  Subject: RE: how to obtain the SQL code from a Query object?
  
  
  Hi Thomas,
  
  I can't find the broker.serviceSqlGenerator() method.
  
  I'm using OJB 0.9.5.
  Is it the problem?
  
  Thanks
  Sylvain
  
  
  
  -Message d'origine-
  De: Mahler Thomas [mailto:[EMAIL PROTECTED]
  Date: lundi, 17. mars 2003 10:59
  À: 'OJB Users List'
  Objet: RE: how to obtain the SQL code from a Query object?
  
  
  The Query object is not able to return SQL code, as it does 
  not have any
  platform specific know how.
  You have to ask the OJB SqlGenerator component to generate SQL:
  
  PersistenceBroker broker = ...
  Query query = ...;
  ClassDescriptor cld = ...;
  
  // obtain prepared stmt sql:
  String sql = 
  broker.serviceSqlGenerator().getPreparedSelectStatement(query,
  cld);
  
  // obtain no prepared sql: 
  sql = 
 broker.serviceSqlGenerator().getSelectStatementDep(query, cld);
  
  cheers,
  thomas
  
   -Original Message-
   From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]
   Sent: Monday, March 17, 2003 10:32 AM
   To: [EMAIL PROTECTED]
   Subject: how to obtain the SQL code from a Query object?
   
   
   Hello,
   
   I have this query:
   
   code
   Criteria crit = new Criteria();
   crit.addEqualTo(workstationName, U68111);
   
   Query query = new QueryByCriteria(Workstation.class, crit, true);
   code
   
   Is there a way to obtain the SQL query (select * from 
   Workstation where) from the query object?
   
   Thanks
   Sylvain
   
   
  
 -
   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]
 
 


-
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: RE : how to manipulate many repository

2003-03-18 Thread TINE Houari (OBJECTIVA)
No, I really want to manipulate 2 differents repository not the same
repository with different connections.

Consider repository1.xml and repository2.xml. Each repository define a
different way to load object A (for example). 

Repository1.xml

class-descriptor class=test.ojb.A table=TABLE_A
  field-descriptor id=1 name=id column=ID jdbc-type=INTEGER
primarykey=true autoincrement=true /
  field-descriptor id=2 name=name column=NAME jdbc-type=INTEGER /
/class-descriptor

Repository2.xml

class-descriptor class=test.ojb.A table=TABLE_A
  field-descriptor id=1 name=id column=ID jdbc-type=INTEGER
primarykey=true autoincrement=true /
  field-descriptor id=2 name=name column=NAME jdbc-type=INTEGER /
  field-descriptor id=3 name=fk1 column=FK1 jdbc-type=INTEGER /
  field-descriptor id=4 name=fk2 column=FK2 jdbc-type=INTEGER /

  reference-descriptor name=referenceB class-ref=test.ojb.C
auto-delete=true auto-update=true
foreignkey field-id-ref=3 /
  /reference-descriptor

  reference-descriptor name=referenceC class-ref=test.ojb.D
foreignkey field-id-ref=4 /
  /reference-descriptor
/class-descriptor

How can I do?


 -Message d'origine-
De :Emmanuel Dupont [mailto:[EMAIL PROTECTED] 
Envoyé :mardi 18 mars 2003 14:35
À : 'OJB Users List'
Objet : RE : how to manipulate many repository

Yes !


-Message d'origine-
De : TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 18 mars 2003 14:18
À : 'OJB Users List'
Objet : how to manipulate many repository

Hi,

I want to handle many repository in the same projet. But the first parameter
of createPersistenceBroker(RepositoryFile, String, String) don't correspond
of the file name: it seems to correspond to jcd-alias. That right?

Houar

 -Message d'origine-
De :TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED] 
Envoyé :mardi 18 mars 2003 13:59
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Hi,

I use P6Spy to see generated sql at runtime.

Houar

 -Message d'origine-
De :Mahler Thomas [mailto:[EMAIL PROTECTED] 
Envoyé :lundi 17 mars 2003 17:46
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Mhh,

I don't know all API changes since 0.9.5 by heart, but the
SqlGeneratorFactory is really a very old piece of code.
have a look in the org.apache.ojb.broker.accesslayer.sql package

Maybe you can also instaiate SqlGenerator directly?!

cheers,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 17, 2003 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: RE: how to obtain the SQL code from a Query object?
 
 
 Thomas,
 
 Thanks for your help!
 
 How do you use this SqlGeneratorFactory. This class doesn't 
 seem to be in OJB 0.9.5.
 
 I think that I could migrate to 1.0 but I don't know what 
 exactly I will have to change in my code.
 
 Best.
 Sylvain
 
 -Message d'origine-
 De: Mahler Thomas [mailto:[EMAIL PROTECTED]
 Date: lundi, 17. mars 2003 16:12
 À: 'OJB Users List'
 Objet: RE: how to obtain the SQL code from a Query object?
 
 
 Hi Sylvain,
 
 I think so!
 But you can use the SqlGeneratorFactory to obtain a 
 SqlGenerator instance
 instead!
 
 cheers,
 Thomas
 
  -Original Message-
  From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 17, 2003 3:59 PM
  To: [EMAIL PROTECTED]
  Subject: RE: how to obtain the SQL code from a Query object?
  
  
  Hi Thomas,
  
  I can't find the broker.serviceSqlGenerator() method.
  
  I'm using OJB 0.9.5.
  Is it the problem?
  
  Thanks
  Sylvain
  
  
  
  -Message d'origine-
  De: Mahler Thomas [mailto:[EMAIL PROTECTED]
  Date: lundi, 17. mars 2003 10:59
  À: 'OJB Users List'
  Objet: RE: how to obtain the SQL code from a Query object?
  
  
  The Query object is not able to return SQL code, as it does 
  not have any
  platform specific know how.
  You have to ask the OJB SqlGenerator component to generate SQL:
  
  PersistenceBroker broker = ...
  Query query = ...;
  ClassDescriptor cld = ...;
  
  // obtain prepared stmt sql:
  String sql = 
  broker.serviceSqlGenerator().getPreparedSelectStatement(query,
  cld);
  
  // obtain no prepared sql: 
  sql = 
 broker.serviceSqlGenerator().getSelectStatementDep(query, cld);
  
  cheers,
  thomas
  
   -Original Message-
   From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]
   Sent: Monday, March 17, 2003 10:32 AM
   To: [EMAIL PROTECTED]
   Subject: how to obtain the SQL code from a Query object?
   
   
   Hello,
   
   I have this query:
   
   code
   Criteria crit = new Criteria();
   crit.addEqualTo(workstationName, U68111);
   
   Query query = new QueryByCriteria(Workstation.class, crit, true);
   code
   
   Is there a way to obtain the SQL query (select * from 
   Workstation where) from the query object?
   
   Thanks
   Sylvain

Re: RE : how to manipulate many repository

2003-03-18 Thread Armin Waibel
That's no problem (in theory ;-))
It's possible to change metadata at runtime
and per thread.
So it's possible e.g. to allow 'admin' handle with repository1
and 'guest' with repository2.
Is this what you mean?
If so take a look in the MetadataManager javadoc.

In further versions of the MetadataManager (maybe) I will
implement the possibility to handle with 'repository-profiles'
to simplify the above example - if ojb-users are interested in
such a feature ;-)


regards,
Armin

- Original Message -
From: TINE Houari (OBJECTIVA) [EMAIL PROTECTED]
To: 'OJB Users List' [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 2:49 PM
Subject: RE: RE : how to manipulate many repository


No, I really want to manipulate 2 differents repository not the same
repository with different connections.

Consider repository1.xml and repository2.xml. Each repository define a
different way to load object A (for example).

Repository1.xml

class-descriptor class=test.ojb.A table=TABLE_A
  field-descriptor id=1 name=id column=ID jdbc-type=INTEGER
primarykey=true autoincrement=true /
  field-descriptor id=2 name=name column=NAME jdbc-type=INTEGER
/
/class-descriptor

Repository2.xml

class-descriptor class=test.ojb.A table=TABLE_A
  field-descriptor id=1 name=id column=ID jdbc-type=INTEGER
primarykey=true autoincrement=true /
  field-descriptor id=2 name=name column=NAME jdbc-type=INTEGER
/
  field-descriptor id=3 name=fk1 column=FK1 jdbc-type=INTEGER
/
  field-descriptor id=4 name=fk2 column=FK2 jdbc-type=INTEGER
/

  reference-descriptor name=referenceB class-ref=test.ojb.C
auto-delete=true auto-update=true
foreignkey field-id-ref=3 /
  /reference-descriptor

  reference-descriptor name=referenceC class-ref=test.ojb.D
foreignkey field-id-ref=4 /
  /reference-descriptor
/class-descriptor

How can I do?


 -Message d'origine-
De : Emmanuel Dupont [mailto:[EMAIL PROTECTED]
Envoyé : mardi 18 mars 2003 14:35
À : 'OJB Users List'
Objet : RE : how to manipulate many repository

Yes !


-Message d'origine-
De : TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED]
Envoyé : mardi 18 mars 2003 14:18
À : 'OJB Users List'
Objet : how to manipulate many repository

Hi,

I want to handle many repository in the same projet. But the first
parameter
of createPersistenceBroker(RepositoryFile, String, String) don't
correspond
of the file name: it seems to correspond to jcd-alias. That right?

Houar

 -Message d'origine-
De : TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED]
Envoyé : mardi 18 mars 2003 13:59
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Hi,

I use P6Spy to see generated sql at runtime.

Houar

 -Message d'origine-
De : Mahler Thomas [mailto:[EMAIL PROTECTED]
Envoyé : lundi 17 mars 2003 17:46
À : 'OJB Users List'
Objet : RE: how to obtain the SQL code from a Query object?

Mhh,

I don't know all API changes since 0.9.5 by heart, but the
SqlGeneratorFactory is really a very old piece of code.
have a look in the org.apache.ojb.broker.accesslayer.sql package

Maybe you can also instaiate SqlGenerator directly?!

cheers,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 17, 2003 4:30 PM
 To: [EMAIL PROTECTED]
 Subject: RE: how to obtain the SQL code from a Query object?


 Thomas,

 Thanks for your help!

 How do you use this SqlGeneratorFactory. This class doesn't
 seem to be in OJB 0.9.5.

 I think that I could migrate to 1.0 but I don't know what
 exactly I will have to change in my code.

 Best.
 Sylvain

 -Message d'origine-
 De: Mahler Thomas [mailto:[EMAIL PROTECTED]
 Date: lundi, 17. mars 2003 16:12
 À: 'OJB Users List'
 Objet: RE: how to obtain the SQL code from a Query object?


 Hi Sylvain,

 I think so!
 But you can use the SqlGeneratorFactory to obtain a
 SqlGenerator instance
 instead!

 cheers,
 Thomas

  -Original Message-
  From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 17, 2003 3:59 PM
  To: [EMAIL PROTECTED]
  Subject: RE: how to obtain the SQL code from a Query object?
 
 
  Hi Thomas,
 
  I can't find the broker.serviceSqlGenerator() method.
 
  I'm using OJB 0.9.5.
  Is it the problem?
 
  Thanks
  Sylvain
 
 
 
  -Message d'origine-
  De: Mahler Thomas [mailto:[EMAIL PROTECTED]
  Date: lundi, 17. mars 2003 10:59
  À: 'OJB Users List'
  Objet: RE: how to obtain the SQL code from a Query object?
 
 
  The Query object is not able to return SQL code, as it does
  not have any
  platform specific know how.
  You have to ask the OJB SqlGenerator component to generate SQL:
 
  PersistenceBroker broker = ...
  Query query = ...;
  ClassDescriptor cld = ...;
 
  // obtain prepared stmt sql:
  String sql =
  broker.serviceSqlGenerator().getPreparedSelectStatement(query,
  cld);
 
  // obtain no prepared sql:
  sql =
 broker.serviceSqlGenerator().getSelectStatementDep(query, cld);
 
  cheers