Sylvain Juge wrote:

I'm trying to use OJB API, and especially Object Persistance, but it doesn't work.

I can build without any errors, the database schema is properly generated and executed on the RDBMS (MySQL).
I've tried with default configuration files provided in ojb-blank, thus using embedded database, and I get exactly the same results.


When I try to use PersistanceBroker, I've got two problems :

-- I get an error because there's no default PBKey when I try to get the default Broker :

broker = PersistenceBrokerFactory.defaultPersistenceBroker()
results in :


Exception in thread "main" org.apache.ojb.broker.PBFactoryException: There was no default-PBKey specified
at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(PersistenceBrokerFactoryBaseImpl.java:157)
at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(PersistenceBrokerFactory.java:65)
at PBSample.storeProduct(PBSample.java:19)
at Application.run(Application.java:37)
at Application.main(Application.java:28)


Are you sure that OJB was correctly initialized ? It seems that the connection descriptors were not correctly loaded. You should set the logging level of OJB to debug or info to see whether OJB had any problems loading the repository file.
You can also check in your code by querying the connection repository which is accessible via


ConnectionRepository connRep = MetadataManager.getInstance().connectionRepository();

See its API for details:

http://db.apache.org/ojb/api/org/apache/ojb/broker/metadata/ConnectionRepository.html

Tom


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



Reply via email to