Re: Exception in thread "main" java.lang.ExceptionInInitializerError

2004-02-14 Thread Brian McCallister
I am pretty sure that the full repository files are included in the  
ojb-blank jar -- I just tested it anyway and they are.

they should all be located in ojb-blank/src/resources/

-Brian

On Feb 14, 2004, at 10:37 AM, Sven Alisch wrote:

Hello Armin,

The Template i use, ojb-blank, only includes a repository_user.xml  
file. So i
look into the OJB.properties, and there i find the line
"repositoryFile=repository.xml". So I decided to change that line to
repository_user.xml. If I do not I get the error message:

Can not read repository class descriptor data, using repository:
repository.xml
The question is, where is that file repository.xml with the  
xml-reference and
why is it not included in ojb-blank.jar???

Thanks,
Sven
Am Samstag, 14. Februar 2004 18:51 schrieb Armin Waibel:
Hi Sven,

Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not
read

repository class descriptor data, using repository:
repository_user.xml
seems that properties file was found, but OJB has a problem with your
repository file.
Why try OJB to read repository_user.xml - did you set this in
OJB.properties? OJB should try to read repository.xml file. This file
has an xml-reference to repository_user.xml. Or put all together in  
one
xml-file.

regards,
Armin
Sven Alisch wrote:
Hi ML,

after i copied all files (including OJB.properties and  
repository.xml) in
../ressources to the path where my class-files are situated, the i  
get
new error messages like these:

Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaul 
tKey
(Unknown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPe 
rsis
tenceBroker(Unknown Source)
at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBrok 
er(U
nknown Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not  
read
repository class descriptor data, using repository:  
repository_user.xml
at  
org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
Source) at  
org.apache.ojb.broker.metadata.MetadataManager.(Unknown
Source)
at
org.apache.ojb.broker.metadata.MetadataManager.(Unknown  
Source)
... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException:  
Exception
when reading metadata information, please check your repository.xml  
file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)  
at
org.apache.crimson.parser.Parser2.parse(Parser2.java:333) at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXM 
L(Un
known Source)
at
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Un 
know
n Source)
at
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepo 
sito
ry(Unknown Source)
... 7 more

Same program like in my last post. What is ment with these  
exceptions???

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


-
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: OK Last Question for Today!

2004-02-14 Thread Armin Waibel
If all declared xml-reference files are in the same directory as the 
repository.xml file, OJB will start reading metadata.
If something wrong with your metadata definitions, please enable debug 
logging level for
org.apache.ojb.broker.metadata.RepositoryXmlHandler
org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler
in properties file of your log-api. If you use OJB default, you can set 
this in OJB.properties file. Then you can see when the exception occur 
while reading.

regards,
Armin
Sven Alisch wrote:

Dear Armin,

The last question was stupid maybe, ok - i found the original 
repository.xml-file with all references. Now really, everything is in my 
classpath. My userdefined mapping i place into the repository_user.xml, 
because repository.xml use it as a reference. Please look. My userdefined 
repository_user.xml looks like following (complete file! is included at the 
end);

And now I want to run my app: I get these messages:
Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown 
Source)
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
repository class descriptor data, using repository: repository.xml
at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
reading metadata information, please check your repository.xml file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
Source)
... 7 more

I'm out of order! ;-) Do you have any further ideas???

File repository_user.xml:





name="emailID"
element-class-ref="jegmont.Emails"
orderby="emailID"
sort="DESC"
 >

 
















































-
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: Exception in thread "main" java.lang.ExceptionInInitializerError

2004-02-14 Thread Armin Waibel
Sven Alisch wrote:

Hello Armin,

The Template i use, ojb-blank, only includes a repository_user.xml file. So i 
look into the OJB.properties, and there i find the line 
"repositoryFile=repository.xml". So I decided to change that line to 
repository_user.xml. If I do not I get the error message: 

ok, now it's more clear. You need the repository.xml and 
repository_database files too (do not change entry in OJB.properties).
Or define jdbc-connection-descriptor direct in repository.xml file 
(without using a xml-reference).
Your repository.xml file may look like this




]>

&database;
&user;

Maybe you need class-descriptor of the internal tables too.

regards,
Armin
Can not read repository class descriptor data, using repository: 
repository.xml

The question is, where is that file repository.xml with the xml-reference and 
why is it not included in ojb-blank.jar???

Thanks,
Sven
Am Samstag, 14. Februar 2004 18:51 schrieb Armin Waibel:

Hi Sven,

> Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not

read

> repository class descriptor data, using repository:
> repository_user.xml
seems that properties file was found, but OJB has a problem with your
repository file.
Why try OJB to read repository_user.xml - did you set this in
OJB.properties? OJB should try to read repository.xml file. This file
has an xml-reference to repository_user.xml. Or put all together in one
xml-file.
regards,
Armin
Sven Alisch wrote:

Hi ML,

after i copied all files (including OJB.properties and repository.xml) in
../ressources to the path where my class-files are situated, the i get
new error messages like these:
Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
   at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey
(Unknown Source)
   at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersis
tenceBroker(Unknown Source)
   at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(U
nknown Source)
   at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read
repository class descriptor data, using repository: repository_user.xml
   at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
Source) at org.apache.ojb.broker.metadata.MetadataManager.(Unknown
Source)
   at
org.apache.ojb.broker.metadata.MetadataManager.(Unknown Source)
   ... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception
when reading metadata information, please check your repository.xml file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658) at
org.apache.crimson.parser.Parser2.parse(Parser2.java:333) at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
   at
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Un
known Source)
   at
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknow
n Source)
   at
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorReposito
ry(Unknown Source)
   ... 7 more
Same program like in my last post. What is ment with these exceptions???

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


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


OK Last Question for Today!

2004-02-14 Thread Sven Alisch
Dear Armin,

The last question was stupid maybe, ok - i found the original 
repository.xml-file with all references. Now really, everything is in my 
classpath. My userdefined mapping i place into the repository_user.xml, 
because repository.xml use it as a reference. Please look. My userdefined 
repository_user.xml looks like following (complete file! is included at the 
end);

And now I want to run my app: I get these messages:
Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown
 
Source)
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
repository class descriptor data, using repository: repository.xml
at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
reading metadata information, please check your repository.xml file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
Source)
... 7 more

I'm out of order! ;-) Do you have any further ideas???

File repository_user.xml:






 

















































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



Re: ODMG: PostgreSQL database connection not closed

2004-02-14 Thread Armin Waibel
Hi Rainer,

Rainer Klute wrote:

I use the OJB implementation of the ODMG API in a web application environment with Tomcat 5 and PostgreSQL 7.4. During development I often redeploy my application into the running Tomcat. When the servlet context is shutdown, I call org.odmg.Database.close() to close the database connection.

However, the connection is still hanging around which can be noticed by PostgreSQL's postmaster processes. (PostgreSQL has one process per database connection.) After several edit-compile-deploy cycles I have a lot of them. Only when I shutdown Tomcat the processes and the connections disappear. I suspect that org.odmg.Database.close() does not really close the database connection.

you are right odmg.Database implementation does not close any 
connections. By default OJB use a connection pool, thus connections will 
never be closed by OJB (configurabale by 'ConnectionFactoryClass' in 
OJB.properties).

For development you can try a workaround like this
((ConnectionManagerImpl)broker.serviceConnectionManager()).getUnderlyingConnectionFactory().releaseAllResources()
regards,
Armin
Best regards
Rainer Klute
   Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute E-Mail:  [EMAIL PROTECTED]
  Körner Grund 24  Telefon: +49 172 2324824
D-44143 Dortmund   Telefax: +49 231 5349423
-
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: Exception in thread "main" java.lang.ExceptionInInitializerError

2004-02-14 Thread Sven Alisch
Hello Armin,

The Template i use, ojb-blank, only includes a repository_user.xml file. So i 
look into the OJB.properties, and there i find the line 
"repositoryFile=repository.xml". So I decided to change that line to 
repository_user.xml. If I do not I get the error message: 

Can not read repository class descriptor data, using repository: 
repository.xml

The question is, where is that file repository.xml with the xml-reference and 
why is it not included in ojb-blank.jar???

Thanks,
Sven

Am Samstag, 14. Februar 2004 18:51 schrieb Armin Waibel:
> Hi Sven,
>
>  > Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not
>
> read
>
>  > repository class descriptor data, using repository:
>  > repository_user.xml
>
> seems that properties file was found, but OJB has a problem with your
> repository file.
> Why try OJB to read repository_user.xml - did you set this in
> OJB.properties? OJB should try to read repository.xml file. This file
> has an xml-reference to repository_user.xml. Or put all together in one
> xml-file.
>
> regards,
> Armin
>
> Sven Alisch wrote:
> > Hi ML,
> >
> > after i copied all files (including OJB.properties and repository.xml) in
> > ../ressources to the path where my class-files are situated, the i get
> > new error messages like these:
> >
> > Hello OJB!
> > Exception in thread "main" java.lang.ExceptionInInitializerError
> > at
> > org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey
> >(Unknown Source)
> > at
> > org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersis
> >tenceBroker(Unknown Source)
> > at
> > org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(U
> >nknown Source)
> > at JEgmont.main(Unknown Source)
> > Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read
> > repository class descriptor data, using repository: repository_user.xml
> > at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
> > Source) at org.apache.ojb.broker.metadata.MetadataManager.(Unknown
> > Source)
> > at
> > org.apache.ojb.broker.metadata.MetadataManager.(Unknown Source)
> > ... 4 more
> > Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception
> > when reading metadata information, please check your repository.xml file
> > at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658) at
> > org.apache.crimson.parser.Parser2.parse(Parser2.java:333) at
> > org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
> > at
> > org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Un
> >known Source)
> > at
> > org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknow
> >n Source)
> > at
> > org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorReposito
> >ry(Unknown Source)
> > ... 7 more
> >
> > Same program like in my last post. What is ment with these exceptions???
> >
> > Thanks,
> > 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]


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



Re: Exception in thread "main" java.lang.ExceptionInInitializerError

2004-02-14 Thread Armin Waibel
Hi Sven,

> Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not 
read
> repository class descriptor data, using repository:
> repository_user.xml

seems that properties file was found, but OJB has a problem with your 
repository file.
Why try OJB to read repository_user.xml - did you set this in 
OJB.properties? OJB should try to read repository.xml file. This file 
has an xml-reference to repository_user.xml. Or put all together in one 
xml-file.

regards,
Armin
Sven Alisch wrote:

Hi ML,

after i copied all files (including OJB.properties and repository.xml) in 
../ressources to the path where my class-files are situated, the i get new 
error messages like these:

Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown 
Source)
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
repository class descriptor data, using repository: repository_user.xml
at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
reading metadata information, please check your repository.xml file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
Source)
... 7 more

Same program like in my last post. What is ment with these exceptions???

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


ODMG: PostgreSQL database connection not closed

2004-02-14 Thread Rainer Klute
I use the OJB implementation of the ODMG API in a web application environment with 
Tomcat 5 and PostgreSQL 7.4. During development I often redeploy my application into 
the running Tomcat. When the servlet context is shutdown, I call 
org.odmg.Database.close() to close the database connection.

However, the connection is still hanging around which can be noticed by PostgreSQL's 
postmaster processes. (PostgreSQL has one process per database connection.) After 
several edit-compile-deploy cycles I have a lot of them. Only when I shutdown Tomcat 
the processes and the connections disappear. I suspect that org.odmg.Database.close() 
does not really close the database connection.

Best regards
Rainer Klute

   Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute E-Mail:  [EMAIL PROTECTED]
  Körner Grund 24  Telefon: +49 172 2324824
D-44143 Dortmund   Telefax: +49 231 5349423

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



Exception in thread "main" java.lang.ExceptionInInitializerError

2004-02-14 Thread Sven Alisch
Hi ML,

after i copied all files (including OJB.properties and repository.xml) in 
../ressources to the path where my class-files are situated, the i get new 
error messages like these:

Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown
 
Source)
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
repository class descriptor data, using repository: repository_user.xml
at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
at org.apache.ojb.broker.metadata.MetadataManager.(Unknown 
Source)
... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
reading metadata information, please check your repository.xml file
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
Source)
at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
Source)
... 7 more

Same program like in my last post. What is ment with these exceptions???

Thanks,
Sven


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



Re: [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object

2004-02-14 Thread Armin Waibel
hmm strange, your posted error message says that property 
'PersistenceBrokerFactoryClass' could not be found, so maybe your 
OJB.properties file is corrupt or OJB read the "wrong" file.
Try something like
-DOJB.properties=../ressourcec/OJB.properties

regards,
Armin
Sven Alisch wrote:

The difference is: if i start my prog with direct instructions like

java -DOJB.properties=../ressourcec JEgmont

than the line 

[BOOT] ERROR: Cannot get OJB properties file, try to use default settings!

is missing.

If I start it without the parameter D than the line is shown by OJB.

Am Samstag, 14. Februar 2004 15:29 schrieb Sven Alisch:

Thanks Armin,
for the fast answer! First I edited the build.xml file for setting
references to that file, later i copied it into the lid dir and now I
copied that file in my classpath /usr/lib/java2/jre/ext ..., but the result
is always the same. I get this error message.
greetings,
sven
Am Samstag, 14. Februar 2004 17:20 schrieb Armin Waibel:

Hi Sven,

> at JEgmont.main(Unknown Source)
> Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
> 'PersistenceBrokerFactoryClass' can not be found in properties file
Seems that OJB.properties file is not in classpath.

regards,
Armin
Sven Alisch wrote:

Hello ML,

I'm a newbie, sorry for my posting, i know this was discussed in past,
but i don't get rid of that error message in this subject.
I create my application from template ojb-blank.

I created my repository_user.xml in directory ./src/ressources/ and it
looks like (it is only an extract - after snip and it ends before snap)
:



   
   
   
   
   
   


My Class for that exsample is:

public class Users
{
  public Users()
  {
  }
  /** auto_increment */
  private Integer userID;
  private String name;
  private String surname;
  private String login;
  private String password;
 // Getters & Setters ...

}

Now I do following in my Main for testing:

import java.util.*;

import org.apache.ojb.broker.*;
import org.apache.ojb.broker.query.*;
import jegmont.*;

public class JEgmont {

   public static void main(String args[]) {
   System.out.println("Hello OJB!");
   PersistenceBroker broker = null;
   try {
   broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
   Users Template = new
Users();Template.setName("Alisch");
   QueryByCriteria query = new
QueryByCriteria(Template); Users alisch = (Users)
broker.getObjectByQuery(query); System.out.println(alisch.getName());
   }
   finally {
   if (broker != null) broker.close();
   }
   }
}

I compiled everything with ant. If I start my app with java
-DOJB.properties JEgmont - the following error occured:
Hello OJB!
[BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance
failed, can't get PBF class object
Exception in thread "main" java.lang.ExceptionInInitializerError
   at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker
(U nknown Source)
   at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
'PersistenceBrokerFactoryClass' can not be found in properties file
   at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown
Source)
   at
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unk
no wn Source)
   ... 2 more
Please help me, i have absolutly no idea for a solution.

Greetings,
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]
-
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: [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object

2004-02-14 Thread Sven Alisch
The difference is: if i start my prog with direct instructions like

java -DOJB.properties=../ressourcec JEgmont

than the line 

[BOOT] ERROR: Cannot get OJB properties file, try to use default settings!

is missing.

If I start it without the parameter D than the line is shown by OJB.

Am Samstag, 14. Februar 2004 15:29 schrieb Sven Alisch:
> Thanks Armin,
> for the fast answer! First I edited the build.xml file for setting
> references to that file, later i copied it into the lid dir and now I
> copied that file in my classpath /usr/lib/java2/jre/ext ..., but the result
> is always the same. I get this error message.
>
> greetings,
> sven
>
> Am Samstag, 14. Februar 2004 17:20 schrieb Armin Waibel:
> > Hi Sven,
> >
> >  > at JEgmont.main(Unknown Source)
> >  > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
> >  > 'PersistenceBrokerFactoryClass' can not be found in properties file
> >
> > Seems that OJB.properties file is not in classpath.
> >
> > regards,
> > Armin
> >
> > Sven Alisch wrote:
> > > Hello ML,
> > >
> > > I'm a newbie, sorry for my posting, i know this was discussed in past,
> > > but i don't get rid of that error message in this subject.
> > >
> > > I create my application from template ojb-blank.
> > >
> > > I created my repository_user.xml in directory ./src/ressources/ and it
> > > looks like (it is only an extract - after snip and it ends before snap)
> > > :
> > >
> > > 
> > >
> > > 
> > >  > > default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
> > >  > > default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
> > >  > > default-fetch="true" column="SURNAME" jdbc-type="VARCHAR"/>
> > >  > > default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
> > >  > > default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
> > > 
> > >
> > > 
> > >
> > > My Class for that exsample is:
> > >
> > > public class Users
> > > {
> > >
> > >public Users()
> > >{
> > >}
> > >
> > >/** auto_increment */
> > >private Integer userID;
> > >private String name;
> > >private String surname;
> > >private String login;
> > >private String password;
> > >
> > >   // Getters & Setters ...
> > >
> > > }
> > >
> > > Now I do following in my Main for testing:
> > >
> > > import java.util.*;
> > >
> > > import org.apache.ojb.broker.*;
> > > import org.apache.ojb.broker.query.*;
> > >
> > > import jegmont.*;
> > >
> > > public class JEgmont {
> > >
> > > public static void main(String args[]) {
> > > System.out.println("Hello OJB!");
> > >
> > > PersistenceBroker broker = null;
> > > try {
> > > broker =
> > > PersistenceBrokerFactory.defaultPersistenceBroker();
> > > Users Template = new
> > > Users();Template.setName("Alisch");
> > > QueryByCriteria query = new
> > > QueryByCriteria(Template); Users alisch = (Users)
> > > broker.getObjectByQuery(query); System.out.println(alisch.getName());
> > > }
> > > finally {
> > > if (broker != null) broker.close();
> > > }
> > > }
> > >
> > > }
> > >
> > > I compiled everything with ant. If I start my app with java
> > > -DOJB.properties JEgmont - the following error occured:
> > >
> > > Hello OJB!
> > > [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance
> > > failed, can't get PBF class object
> > > Exception in thread "main" java.lang.ExceptionInInitializerError
> > > at
> > > org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker
> > >(U nknown Source)
> > > at JEgmont.main(Unknown Source)
> > > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
> > > 'PersistenceBrokerFactoryClass' can not be found in properties file
> > > at
> > > org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown
> > > Source)
> > > at
> > > org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unk
> > >no wn Source)
> > > ... 2 more
> > >
> > > Please help me, i have absolutly no idea for a solution.
> > >
> > > Greetings,
> > > 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]
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Re: [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object

2004-02-14 Thread Sven Alisch
Thanks Armin, 
for the fast answer! First I edited the build.xml file for setting references 
to that file, later i copied it into the lid dir and now I copied that file 
in my classpath /usr/lib/java2/jre/ext ..., but the result is always the 
same. I get this error message. 

greetings,
sven

Am Samstag, 14. Februar 2004 17:20 schrieb Armin Waibel:
> Hi Sven,
>
>  > at JEgmont.main(Unknown Source)
>  > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
>  > 'PersistenceBrokerFactoryClass' can not be found in properties file
>
> Seems that OJB.properties file is not in classpath.
>
> regards,
> Armin
>
> Sven Alisch wrote:
> > Hello ML,
> >
> > I'm a newbie, sorry for my posting, i know this was discussed in past,
> > but i don't get rid of that error message in this subject.
> >
> > I create my application from template ojb-blank.
> >
> > I created my repository_user.xml in directory ./src/ressources/ and it
> > looks like (it is only an extract - after snip and it ends before snap) :
> >
> > 
> >
> > 
> >  > default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
> >  > default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
> >  > default-fetch="true" column="SURNAME" jdbc-type="VARCHAR"/>
> >  > default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
> >  > default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
> > 
> >
> > 
> >
> > My Class for that exsample is:
> >
> > public class Users
> > {
> >
> >public Users()
> >{
> >}
> >
> >/** auto_increment */
> >private Integer userID;
> >private String name;
> >private String surname;
> >private String login;
> >private String password;
> >
> >   // Getters & Setters ...
> >
> > }
> >
> > Now I do following in my Main for testing:
> >
> > import java.util.*;
> >
> > import org.apache.ojb.broker.*;
> > import org.apache.ojb.broker.query.*;
> >
> > import jegmont.*;
> >
> > public class JEgmont {
> >
> > public static void main(String args[]) {
> > System.out.println("Hello OJB!");
> >
> > PersistenceBroker broker = null;
> > try {
> > broker =
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> > Users Template = new
> > Users();Template.setName("Alisch");
> > QueryByCriteria query = new
> > QueryByCriteria(Template); Users alisch = (Users)
> > broker.getObjectByQuery(query); System.out.println(alisch.getName());
> > }
> > finally {
> > if (broker != null) broker.close();
> > }
> > }
> >
> > }
> >
> > I compiled everything with ant. If I start my app with java
> > -DOJB.properties JEgmont - the following error occured:
> >
> > Hello OJB!
> > [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed,
> > can't get PBF class object
> > Exception in thread "main" java.lang.ExceptionInInitializerError
> > at
> > org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(U
> >nknown Source)
> > at JEgmont.main(Unknown Source)
> > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
> > 'PersistenceBrokerFactoryClass' can not be found in properties file
> > at
> > org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown
> > Source)
> > at
> > org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unkno
> >wn Source)
> > ... 2 more
> >
> > Please help me, i have absolutly no idea for a solution.
> >
> > Greetings,
> > 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]


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



Re: [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object

2004-02-14 Thread Armin Waibel
Hi Sven,

> at JEgmont.main(Unknown Source)
> Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key
> 'PersistenceBrokerFactoryClass' can not be found in properties file
Seems that OJB.properties file is not in classpath.

regards,
Armin
Sven Alisch wrote:
Hello ML,

I'm a newbie, sorry for my posting, i know this was discussed in past, but i 
don't get rid of that error message in this subject.

I create my application from template ojb-blank.

I created my repository_user.xml in directory ./src/ressources/ and it looks 
like (it is only an extract - after snip and it ends before snap) :













My Class for that exsample is:

public class Users
{
   public Users()
   {
   }
   /** auto_increment */
   private Integer userID;
   private String name;
   private String surname;
   private String login;
   private String password;
  // Getters & Setters ...

}

Now I do following in my Main for testing:

import java.util.*;

import org.apache.ojb.broker.*;
import org.apache.ojb.broker.query.*;
import jegmont.*;

public class JEgmont {

public static void main(String args[]) {
System.out.println("Hello OJB!");
PersistenceBroker broker = null;
try {
broker = 	
PersistenceBrokerFactory.defaultPersistenceBroker();
Users Template = new 
Users();Template.setName("Alisch");
QueryByCriteria query = new QueryByCriteria(Template);
Users alisch = (Users) broker.getObjectByQuery(query);
System.out.println(alisch.getName());
}
finally {
if (broker != null) broker.close();
}
}

}

I compiled everything with ant. If I start my app with java -DOJB.properties 
JEgmont - the following error occured:

Hello OJB!
[BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, 
can't get PBF class object
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key 
'PersistenceBrokerFactoryClass' can not be found in properties file
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unknown 
Source)
... 2 more

Please help me, i have absolutly no idea for a solution.

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


[BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object

2004-02-14 Thread Sven Alisch
Hello ML,

I'm a newbie, sorry for my posting, i know this was discussed in past, but i 
don't get rid of that error message in this subject.

I create my application from template ojb-blank.

I created my repository_user.xml in directory ./src/ressources/ and it looks 
like (it is only an extract - after snip and it ends before snap) :













My Class for that exsample is:

public class Users
{

   public Users()
   {
   }

   /** auto_increment */
   private Integer userID;
   private String name;
   private String surname;
   private String login;
   private String password;

  // Getters & Setters ...

}

Now I do following in my Main for testing:

import java.util.*;

import org.apache.ojb.broker.*;
import org.apache.ojb.broker.query.*;

import jegmont.*;

public class JEgmont {

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

PersistenceBroker broker = null;
try {
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
Users Template = new 
Users();Template.setName("Alisch");
QueryByCriteria query = new QueryByCriteria(Template);
Users alisch = (Users) broker.getObjectByQuery(query);
System.out.println(alisch.getName());
}
finally {
if (broker != null) broker.close();
}
}

}

I compiled everything with ant. If I start my app with java -DOJB.properties 
JEgmont - the following error occured:

Hello OJB!
[BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, 
can't get PBF class object
Exception in thread "main" java.lang.ExceptionInInitializerError
at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key 
'PersistenceBrokerFactoryClass' can not be found in properties file
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown 
Source)
at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.(Unknown 
Source)
... 2 more

Please help me, i have absolutly no idea for a solution.

Greetings,
Sven


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



Re: QueryFactory issue

2004-02-14 Thread Tino Schöllhorn
Hi,

sorry I got it. It is a database-error. Access doesn't return memo 
fields when using distinct (g). my fault.

tino

Tino Schöllhorn wrote:

Hi,

I could pinpoint the described error which has been described in an 
earliear thread (Cache issue: 13.2.2004). It all boils to the 
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the 
code to retrieve an instance of class Person with:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit);
Collection c = pb.getCollectionByQuery(query);
 and so on
everything works perfectly and the instances of Person are instantiated 
correctly. But if I use the method described in the first place:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.

I think that this might be an error of OJB.

With regards
Tino


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


Re: [Repost with more data]RE: Connection pooling and HSQL

2004-02-14 Thread Armin Waibel
Hi Raghavan,

Kollivakkam R. Raghavan wrote:

I didn't get any responses yet.  Am trying again with more information.
If some guru out there has an answer, I would really appreciate a
response.
sorry, I'm not a guru, but I will try my best ;-)

I'm including a part of the web server logs that shows the
message I am talking about.   After a few calls the connections seem to
spontaneously close.  Is this an HSQL issue?  Something known?
...
> Validation query for connection failed, discard connection. Query was
> select count(*) from role, Message was Connection is closed
...
The message says that the validation query fails, than OJB try to close 
the Connection instance and remove it from pool. The error message was 
"Connection is closed", this could have two (maybe more) reasons:

- Connection was timed out and hsql close it itself.

- In your code you lookup a connection instance from OJB, e.g. using 
ConnectionManager and do an (not allowed) con.close() call on the 
connection, then next time OJB try to use this connection will find an 
closed one.

regards,
Armin
Thanks in advance 
Raghavan

WEB SERVER LOG SEGMENT-
Validation query for connection failed, discard connection. Query was 
select count(*) from role, Message was Connection is closed 13-Feb-2004
12:07:40 INFO  [  CPS-Promotion] 
slayer.ConnectionFactoryPooledImpl
Destroy object was called, try to close connection: 
[EMAIL PROTECTED]
13-Feb-2004 12:07:40 WARN  [  CPS-Promotion] 
slayer.ConnectionFactoryPooledImpl
Validation query for connection failed, discard connection. Query was 
select count(*) from role, Message was Connection is closed 13-Feb-2004
12:07:40 INFO  [  CPS-Promotion] 
slayer.ConnectionFactoryPooledImpl

-

-Original Message-
From: Kollivakkam R. Raghavan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 4:53 PM
To: 'OJB Users List'
Subject: Connection pooling and HSQL

I am using OJB with HSQL and the following connection descriptor in a
Struts based web application.  I very frequently see a message saying
that the connection was closed and destroy object was called.  It
appears as if the connection pooling is not working as it should.  Am I
missing a setting - or is this a known issue.  I could add
whenExhaustedAction=2 to work around it but want to know the root cause.
Thanks in advance. Raghavan

>


className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImp
l">



attribute-value="false"/>

attribute-value="1"/>



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


QueryFactory issue

2004-02-14 Thread Tino Schöllhorn
Hi,

I could pinpoint the described error which has been described in an 
earliear thread (Cache issue: 13.2.2004). It all boils to the 
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the 
code to retrieve an instance of class Person with:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit);
Collection c = pb.getCollectionByQuery(query);
 and so on
everything works perfectly and the instances of Person are instantiated 
correctly. But if I use the method described in the first place:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.

I think that this might be an error of OJB.

With regards
Tino


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


Re: Cache issue

2004-02-14 Thread Armin Waibel
Hi Tino,

I don't think that OJB is the problem (but maybe I'm wrong). The only 
difference between the Criteria is the 'distinct' flag. So I this Access 
has a problem with the distinct flag. Please enable p6spy to trace the 
generated SQL statements.
See
http://db.apache.org/ojb/faq.html#How can I trace and/or profile SQL 
statements executed by OJB?

How does the generated SQL for both Criteria look like?
Try to invoke these statements against your DB and compare the results.
If both statements return the same result ... OJB has a problem ;-)
regards,
Armin
Tino Schöllhorn wrote:
Hello Armin,

I could pinpoint the described error. It all boils to the 
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the 
code to retrieve an instance of class Person with:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit);
   
Collection c = pb.getCollectionByQuery(query);
 and so on

everything works perfectly and the instances of Person are instantiated 
correctly. But if I use the method described in the first place:

Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.

I think that this might be an error of OJB.

With regards
Tino




Armin Waibel wrote:

Hi,

Tino Schöllhorn wrote:

Hi,

I have (again) something weird which I suppose is just a 
configuration problem:

I have a class Person which has one LONGVARCHAR-Field. The first time 
the object is accessed the LONGVARCHAR-field is returned correctly.


hmm, does this mean first time after creation? Which cache was used?
Maybe first time after store it was found in cache, second time it was 
read from DB. So I assume your "database" truncate the String on insert.
Maybe I'm wrong ;-)

regards,
Armin
But the second time it is accessed it returns just 256 (I suppose) 
characters.

I am using Access as 'database' but I don't think this is the problem.

Do you have any ideas what I could try?
Tino


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