1
votes

Help me please to elaborate on how to keep external database connection object correctly (external db servers = MongoDB, OrientDB, Apache SOLR). Its rather general concept we cant resolve correctly for our xPages applications. When connecting to external services as databases are, you have to create connection object on application start/first use and keep it shared(for performance reasons, using some pool mechanism) for application lifetime (I mean singleton like pattern). And here the things come I'm not sure about. In the servlet like environment one ussualy use servlet listener events to connect and disconnect database properly. But how to do it in xPages environment? ApplicationScope seems to be suitable but I cant find a way how to attach on application lifecycle for disconnecting from external database correctly.

According the JSF docs the managed beans should support Managed beans LifeCycle annotations @PostConstruct and @PreDestroy which would solve this nicely. But it doesnt work in xPages ... see my story bellow. Its been reported to IBM and accepted as bug to be fixed in future but haven't been fixed yet. ... Do you have any hint how to do it properly, how to connect and disconnect from ext. database that will work fine with application restarts, automatic unloads etc. ?

http://www-10.lotus.com/ldd/xpagesforum.nsf/topicThread.xsp?documentId=131569D202C110E185257958005B0A7B&action=openDocument

Thank you, David

2

2 Answers

0
votes

@PostConstruct and @PreDestroy is not part of JSF1.2. Perhaps you should look on how the current JDBC connectors in ExtLib are implemented, and use the same logic for other kind of DBs.

0
votes

I just found out the solution described here http://hasselba.ch/blog/?p=740 ...