Re: OJB Console
actually , your server http://www.scrashmeow.org/ojb/index.do is always down :( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to create a LIKE Statement???
It works well with non number fields. I think that you have to look at generated SQL and trying to build right criteria. (you can see all generated SQL queries by setting driver="com.p6spy.engine.spy.P6SpyDriver" in datavase_repository.xml file) sorry, if it will not help you, but I've never used like criteria with NUMBER fields. Hi, I´m trying to make a SELECT * FROM Table WHERE Field LIKE 'XY%' I thought a Criteria theCriteria = new Criteria(); theCriteria.addLike("myAttributeName", anAttributeValue); // where the Attribute Type is BigDecimal should do the Job. But I´m getting a ClassCastException (I think because of the String-Cast at the "addLike(...)" method of Criteria. But even a: theCriteria.addLike("myAttributeName", anAttributeValue+"*"); leads to a ClassCastException because of the DatabaseType BigDeciamal or NUMERIC. Any help would be appreciated! Greetings, Mit freundlichen Grüßen, Ralf Baron-Riege - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection leak problem with OJB RC3 on Weblogic 7.0 SP2
Do you call broker.clcse() method after storing/retriaving operations? Hi, I have got a problem with using OJB RC3 on Weblogic 7.0 SP2. In the Weblogic there's a connection pool and datasource set up. The OJB is connecting to the database via this JNDI Datasource. No matter which ConnectionFactoryClass I set in the OJB.properties, I always get a connection leak error. Is it possible that the OJB doesn't close the connection when it is not used anymore? I'd appreciate your help. Thanks Peter Bona the exception: < > <> <001074> at weblogic.jdbc.pool.Connection.(Connection.java:62) at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnectionObj(RmiD ataSource.java:284) at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiData Source.java:252) at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour ce.java:270) at org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newCo nnectionFromDataSource(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.looku pConnection(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookup Connection(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStateme nt(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unk nown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQue ry(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery (Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery (Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery (Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery (Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery (Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionB yQuery(Unknown Source) The corresponding OJB.properties (part of it): #--- - # ConnectionFactory / Default ConnectionPool #--- - # The ConnectionFactoryClass entry determines which kind of ConnectionFactory # is to be used within org.apache.ojb as connection factory. # A ConnectionFactory is responsible for creating # JDBC Connections. Current version ships four implementations: # # 1. ConnectionFactoryNotPooledImpl #No pooling, no playing around. #Every connection request returns a new connection, #every connection release close the connection. # 2. ConnectionFactoryPooledImpl #This implementation supports connection pooling. # 3. ConnectionFactoryDBCPImpl #Using the jakarta-DBCP api for connection management, support #connection- and prepared statement-pooling, abandoned connection handling. # 4. ConnectionFactoryManagedImpl #Connection factory for use within managed environments - e.g. JBoss. #Every obtained DataSource was wrapped within OJB (and ignore #e.g. con.commit() calls within OJB). #Use this implementation e.g if you use Datasources from an application server. # # Use the OJB performance tests to decide, which implementation is best for you. # The proper way of obtaining a connection is configured in # JDBCConnectionDescriptor entries in the repository.xml file. # If want a more fine grained control of each connection pool used by OJB, # take a look at the repository.dtd, there was a possibility to override # this default connection factory entry in each JDBCConnectionDescriptor. # #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryP ooledImpl #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryN otPooledImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa nagedImpl #ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryD BCPImpl - 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 leak problem with OJB RC3 on Weblogic 7.0 SP2
:) OJB turorial is not a best source for real applications . it's better to take a look to the unit tests code. as you can see in all tests broker closed: PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker(); try { } finally { if (broker != null) broker.close(); } Nope, actually I don't call the broker.close() method. Is it necessary? The example code didn't do that either and the JavaDoc says about the close() method: "Close this PersistenceBroker so that no further requests may be made on it. A PersistenceBroker instance can be used only until it is closed. Closing a PersistenceBroker might release it to the pool of available PersistenceBrokers, or might be garbage collected, at the option of the implementation. " So it might release the broker instance to the pool, not the connection. Or does it automatically closes the underlying Connection object? I'll give a try anyway. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [SUMMARY] - Using Xerces 2.4.0
Antonio Gallardo wrote: Alexander Prozor dijo: yes, but you need to change OJB.properties file to do it. change line repositoryFile=repository.xml to repositoryFile=.\\repository.xml stupid solution but it works :). otherwise you new parset will not be able to parse URL of repository.xml file :(. I already upgraded to xerces 2.4.0 and xml-apis.jar In Linux you dont need to do your suggestion. In Linux works simply using: repositoryFile=repository.xml I dont know if this is because I am using JDO. Best Regards, Antonio Gallardo. no, it's because of unix better than windows :). Error rising while initialize MetadataManager, so it doesn't metter what are you using JDO or PB API. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New Xerces.....
yes, but you need to change OJB.properties file to do it. change line repositoryFile=repository.xml to repositoryFile=.\\repository.xml stupid solution but it works :). otherwise you new parset will not be able to parse URL of repository.xml file :(. Hi: Can we use the new xerces.jar (version 2.4.0) and xml-apis.jar? Best Regards, Antonio Gallardo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using OJB with EJB session beans.
Are there some limitations for using OJB in such situation? limitations no, but you have to pay attention using caching (clustering), locking, sequence generation, proxy objects (e.g. it's not possible to use proxy classes - "lazy loading"/ "lazy materialization" - when using OJB within ejb). thank you very much, I've a little surpised about using proxy ( but I understand the reason of this problem, we have to use some EJB proxy on the client side. and we will be able to use OJB proxy within the server context ). so thank you, this was all that I've interested for. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using OJB with EJB session beans.
Hello all, please help us with this question. We know that OJB is often used in BMP beans but we are going to use OJB from EJB session bean and MDB. As far as we know EJB session bean doesn't allow to run new threads. Are there some limitations for using OJB in such situation? please help, we have to quickly decide can we use OJB for this purpose. thank you very much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: RsIterator question
Hello Mykola, Wednesday, July 2, 2003, 5:27:39 PM, you wrote: MO> The main reason I'm using getIteratorByQuery is because my DB table is MO> pritty big (~100 000 records). Putting all the records into Collection is MO> too memory expensive. MO> I'll very appreciate any help of dealing with big DB tables. you can use Proxy for your collection. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RsIterator question
Hello Mykola, MO> I'm using broker.getIteratorByQuery(query); to return Iterator of all MO> Users in DB. MO> Then I pass this Iterator to JSP page (or Struts as the result it displays nothing. MO> I'm not sure it's the problem with OJB, but - if I pass to JSP page MO> Iterator, created from a Collection - it works OK. MO> Maybe OJB's Iterator - RsIterator doesn't work this way? MO> By the way - is using broker.getIteratorByQuery() the best way to deal with MO> displaying big DB tables? I think no - because of when you get Iterator, OJB will generate SQL for each iter.next() call. maybe will be better to use getCollectionByQuery() - in this case you'll get whole collection at time. but of course I may be wrong. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: More than one class in an OJB-OQL from clause?
Hello Matthias, Please provide example of such query :. Please!!! ML> Ok, I got it, was a newbie question, ML> I couldn't imagine to query collection-attributes using the dot-notation. ML> my feeling right now: ML> OJB is such COOL tool. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: forward-db
Hello Julia, sure, but all information about O/R mapping contains in the repository.xml file. JWBd> what do you mean by generating mapping from java doc comments? I thought JWBd> this tool was for generating the repository.xml out of the java sources? -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forward-db
Hello Julia, ASAIK it don't implemented yet :(. at http://cvs.apache.org/viewcvs/db-ojb/contrib/xdoclet-ojb-module.zip you can get XDoclet module, that allows to generate mapping from java doc comments. JWBd> Hello, JWBd> I've downloaded the latest relaese 1.0 rc3 and found in the documentation JWBd> (tutorial1) the tool support for foward engineering (generating SQL DDL from JWBd> repository.xml). But the ant target named "forward-db" is missing in my JWBd> build.xml. Only the reverse tool with the target "reverse-db" is included. JWBd> Where can I find the tool or how to write the target on my own? JWBd> Thanks, Julia. JWBd> - JWBd> To unsubscribe, e-mail: [EMAIL PROTECTED] JWBd> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Singelton question.
Hello all, how do you propose to work with OJB? I am using ODMG api. I have some persistent broker manager. In constructor of this object I get odmg facade instance - odmgFacade = OJB.getInstance(); in each DB related methods I open db db.open(dataBaseDefName, Database.OPEN_READ_WRITE); open and commit transaction. ? I am not sure, should I close db if I use manageable connection pool and work with db via Datasource. Should broker manager to be singleton? or I have to create new instance of this classes for each client? (I don't tell about clustering, I mean that I use only one JavaVM) thank you very much. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB stable version with ORACLE 9 and WEBSHPERE 5
Hello , some people wrote in this mail list that they has such combination in the production environment. Can you share the version of OJB that you are using and some specific configuration fragments? I use DataSource object defined in WebSphere Server. I don't specify SequenceManager and ConnectionDescriptor in database_repository.xml file ( so OJB use its default implementation, I think ). In the OJB.propeties file I've changed ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl I use ODMG API. so now the questions :) 1. should I specify org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl ? 2. what SequenceManager is better for me, if I've mapped some object into existing tables, that already has some values in their primary key columns? 3. Should I call db.close() method or it will be done automatically? If you use OJB another than 1 rc3, where can I get it, and is there any sense to test such early version? thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with OJB in a servlet container
Maybe you use xalan lib different from OJB original version? it can't parse URL to repository.xml file. OJB don't put XMLreader.parse method in try/catch block so you will not be able to see real situation in the log files :(. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Xalan_j_2_4_1. bug!
Hello OJB, my version of OJB (1 rc 3) doesn't work with this version of xalan. it can't initialize MetaDataManager object. more details: 1. URL of repository file looks like this : "/D:/some folder/repository.xml" I though that new XMLReader can't read it because of first slash. 2. In the metadata manager you are trying to catch Exception. but... after error in initializing block I got ClassDefNotFound ERROR. and you can't catch it in this block because of this is ERROR and not EXCEPTION. btw, could you provide a way to get latest sources of OJB? something like week releases? thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suggestion on ClassHelper
Hi, maybe you could provide the way to use our own ClassHelper. We've created our persistent classes at runtime (and change DB and OJB repository at runtime too). and there is no good way to say OJB to take classes that has been changed. ( ClassLoader cashes classes after first creating ). RY> Hi, RY> When I read OJB source code, I find a ClassHelper RY> class, but it seems that its usage seems not wide. RY> What I mean is that there are many codes in OJB doing RY> object instantation do not use it but have their own. RY> There are ways to instantiate a new object in java. RY> The simplest one is Class.newInstance(). On the other RY> hand, we may first get a constructor and then set its RY> access flag to true and then invoke it to let private RY> constructor can be used (hence object model not RY> instrumented for ojb). I think the latter way seems RY> the best. However, ClassHelper itself have both these RY> two ways (but without setting access flag). Could it RY> be changed to be one way and the latter one? RY> Maybe OJB developers have their own considerations. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Create Query
Hello , is it possible, using PB API, to create search query ( or criteria ) from some text form ( XML for example ). thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Oracle
Hello, Could you tell me, what version of Oracle ( drivers etc.) should I use with OJB rc3 to get all junit tests running? I use oracle 9i. thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Inheritance
Hi Experts, We have object hierarchy : base interface IBaseInterface, and classes that implements it Class0, Class1, Class2 Class0 has reference to the Class1 in the tables for these classes we got identical value of primary keys. (i.e. Class1 pk = 10 and Class2 pk = 10 ). when we try to search for Class0 instances via ODMG OQL query. something like this: select classes from Class0 where name = 'testClass' in PersistentBrokerImpl.getReferencedObject Ojb takes Top level Class for Class1 ( DescriptionRepository.getTopLevelClass()). and Identity: object real class = null; pkvalues = 10; object class = IBaseInterface. and trying to set Class2 object instead of Class1. So we got exception: java.lang.IllegalArgumentException: field type mismatch at org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(PersistenceBrokerImpl.java:1049) at org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(PersistenceBrokerImpl.java:1027) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:462) at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:270) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1418) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1468) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1429) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:292) at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:339) How can we set real class? Maybe it's better to use another query ( PersistentBroker API ). -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[5]: ODMG intialization.
I got such log... [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] [org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl] INFO: OptimisticLockException was thrown, will try again to store sequence. Sequence was [EMAIL PROTECTED],fieldName=ID,grabSize=20,version=12186,maxKey=243720,currentKey=243700] [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] [org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl] INFO: OptimisticLockException was thrown, will try again to store sequence. Sequence was [EMAIL PROTECTED],fieldName=ID,grabSize=20,version=12188,maxKey=243760,currentKey=243740] [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[4]: ODMG intialization.
Hello Armin, OJB 1 Rc3, I use Oracle, and I've tried both driver ( thin and oci8 ). result the same, when I set repository_database.xml sounds strange! Could you give some more information. AW> Code snip, OJB version, repository_database.xml AW> file. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nested Query, Subquery
Hello Again :), is it possible to use nested queries in OJB OQL ? something like : select distinct struct (code: c.crse_code, title: c.crse_title, (select x from c.offers x where x.enrollment < 20)) from courses c or define to classes or more in From statements? thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: ODMG intialization.
Hello Armin, Ok, but I still have problem with Active connections. Try to take example, when I set activeconnections = 10. I can open my page for a 3 times before server crashed ( it contains some db call ). when I set activeconnections = 40 I can do it for 10 times :). and so on. so I am think that I should release connection somewhere. but where? >> connections. ( I also call db.close() after each operations ). AW> is not necessary. Close the database only before open another. >> > Or I just call db.open(...) the first time? AW> yep, that's recommended >> > It's is possible to share db among the different threads? AW> yep! >> > Should I close something at any time, apart committing/aborting >> > transactions? AW> no AW> Using in multithreaded environment this could be AW> done only once: AW> Implementation odmg = OJB.getInstance(); AW> Database db = odmg.newDatabase(); AW> db.open(dbName, Database.OPEN_READ_WRITE); AW> Implementation class is threadsafe. AW> HTH AW> regards, AW> Armin AW> - Original Message - AW> From: "Alexander Prozor" <[EMAIL PROTECTED]> AW> To: "OJB Users List" <[EMAIL PROTECTED]> AW> Sent: Thursday, June 05, 2003 8:52 AM AW> Subject: ODMG intialization. >> Hello , >> I can't find answer for this question... >> But I have a some strange trouble and it looks like I didn't close >> connections. ( I also call db.close() after each operations ). >> Should I call another finalized methods? >> >> thank you. >> >> >> > From: Mauricio CASTRO <[EMAIL PROTECTED]> >> > To: [EMAIL PROTECTED] >> > Date: Saturday, May 24, 2003, 10:30:52 PM >> >> > If I am using ODMG in a multithreaded application. Should I call for AW> each >> > thread the following code? >> > >> > Implementation instance = OJB.getInstance(); >> > Database db = instance.newDatabase(); >> > file://open database >> > db.open(dbName, Database.OPEN_READ_WRITE); >> > odmg.set(instance); >> > >> > Or I just call db.open(...) the first time? >> > It's is possible to share db among the different threads? >> > Should I close something at any time, apart committing/aborting >> > transactions? >> >> >> >> -- >> Best regards, >> Alexander mailto:[EMAIL PROTECTED] >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> AW> - AW> To unsubscribe, e-mail: [EMAIL PROTECTED] AW> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ODMG intialization.
Hello , I can't find answer for this question... But I have a some strange trouble and it looks like I didn't close connections. ( I also call db.close() after each operations ). Should I call another finalized methods? thank you. > From: Mauricio CASTRO <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Date: Saturday, May 24, 2003, 10:30:52 PM > If I am using ODMG in a multithreaded application. Should I call for each > thread the following code? > > Implementation instance = OJB.getInstance(); > Database db = instance.newDatabase(); > //open database > db.open(dbName, Database.OPEN_READ_WRITE); > odmg.set(instance); > > Or I just call db.open(...) the first time? > It's is possible to share db among the different threads? > Should I close something at any time, apart committing/aborting > transactions? -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
WebSphere server, ODMG
Hello , Maybe someone already got such problem. I've wrote app using WebSphere and Oracle. Using servlet, i store object, if I try to get it in this session ( without restarting of the server, I got nothing). when I restart server - I can use Query for load object, but then I am not be able to store it :). each time, when I store or load object I execute such code: odmg = OJB.getInstance(); Database db = odmg.newDatabase(); String dataBaseDefName = buildDefDatabase(); //open database try { //db.open(REPOSITORY_FILE, Database.OPEN_READ_WRITE); db.open(dataBaseDefName, Database.OPEN_READ_WRITE); } catch (ODMGException ex) { } maybe problem there? If I use standalone application, all works fine. thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: HashMap
Hello Thomas, Ok, but, is it possible to store java.lang.Object member ? ( property that can contains String, Integer or other similar type ). I got ClassCastException while try to do this. TM> What's the problem with DMapImpl? It's a proven solution! TM> There are examples on how to use it in the testbed and in TM> repository_junit.xml. TM> Another solution to store a Map member could be to implement your own TM> ManageableCollection class that implements Map. TM> See o.a.ojb.broker.util.collections.ManagegeableHashSet for an example TM> how to do this for a Set member. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HashMap
Hello , does anybody stored HashMap member? (string keys, object values ). I've tried to store it in VARCHAR field ( using appropriate conversion), tried to use ODMG DMapEntry DMapImpl, but nothing helps :(. thank you. -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[3]: anonymous fields
ohhh, now it's work again :) actually I don't understand how it work for now :). another question, does anybody stored HashMap member? -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: anonymous fields
Hi again, actually I was too optimistic, it's work without exception , but only for my test ( when I store object and then get it by query ). when I trying to get previously stored object I got null as value of referenced member :(. controlRoorRef. maybe I have to store this reference descriptor in the 'Table' ? -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping two (or more) classes to one table
Hello Joerg, in the turorial3.html file ( doc ). see the section mapping inheritance hierarchy to the same table. as far as I understand it's required additional column in the table or you have to derive a Class from org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl and overwrite the method selectClassDescriptor to implement your specific type selection mechanism hope to help you. JL> hi, JL> i want to map two classes to the same table. JL> -PartentA JL> -ChildA JL> -ChildB JL> ParentA is abstract. ChildA and ChildB must be retrieved by using JL> the same atttributes (inherited from ParentA). JL> I tried it, but by using the unique-key as JL> >>>crit.addEqualTo("id", "515522"); JL> the wrong class is returned. JL> is there anything special to do in the mapping? JL> joerg JL> - JL> To unsubscribe, e-mail: [EMAIL PROTECTED] JL> For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[4]: anonymous fields
Hello Brian, thank you, but I don't receive any attachments :(. and in cvs I sow old xml file :(. but that's all bad news : the good news that all works now, after moving reference-descriptor to another class ( and adding additional parameter to that class, 'cause OJB didn't see anonymous field in this case - and I don't have time enough to correct this error :) ). so - thank you very much. To:Raymond Barlow <[EMAIL PROTECTED]> Thank you too :) you were right from very begin : BM> I just put the working code into the howto and sent the patch to the BM> developer list, but I figured you might want to correct docs asap - so BM> they are attached. BM> The only real difference (aside from two typos) was the BM> reference-descriptor being in the wrong class def (desk references BM> finish, not finish references desk as it is in cvs right now - that BM> would be a 1:M style). BM> -Brian -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: anonymous fields
Hello Raymond, I think now if example is correct: http://cvs.apache.org/viewcvs/db-ojb/xdocs/howto-use-anonymous-keys.xml?rev=HEAD&content-type=text/vnd.viewcvs-markup Desk contains collection of things and reference to the finish . It's almost identical to my app :(. but for me it doesn't work. But only for CompositeControlDefinition for DataDefinitionRef all works ok. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: anonymous fields
Hello Raymond, child classes store in DB successfully. problem exists only when I try to persist main class. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: anonymous fields
Hello Raymond, sure, I've defined this field in mapping. there are ddl and repository_user.xml files from this project. RB> Is "userDefinitionScreenID" a field defined in your mapping? ie. this RB> has to be the name attribute of a field-descriptor definition. Something RB> like: RB> name="userDefinitionScreenID" RB> column="_idA" RB> jdbc-type="INTEGER" RB> access="anonymous"/> RB> Maybe if you post the relevant sections of your repository_user.xml file RB> it could help identify the problem. -- Best regards, Alexandermailto:[EMAIL PROTECTED] > CREATE TABLE GUIComponentDefinitionTable ( internal_id INTEGER PRIMARY KEY, name VARCHAR(52) NOT NULL, type VARCHAR(52) NOT NULL, value VARCHAR(52) NOT NULL, id VARCHAR(52) NOT NULL ); CREATE TABLE DataDefinitionRefTable( internal_id INTEGER PRIMARY KEY, dataDefName VARCHAR(30) NOT NULL, queryDefName VARCHAR(30) NOT NULL, userDefinitionScreenID INTEGER, FOREIGN KEY (userDefinitionScreenID) REFERENCES GUIComponentDefinitionTable(internal_id ) ); CREATE TABLE ControlDefinitionTable ( internal_id INTEGER PRIMARY KEY, name VARCHAR(52) NOT NULL, type VARCHAR(52) NOT NULL, value VARCHAR(52) NOT NULL, id VARCHAR(52) NOT NULL, properties_map VARCHAR(4000), dataDefName VARCHAR(30) NOT NULL, modelReference VARCHAR(30) NOT NULL, userDefinitionScreenID INTEGER, selfReferenceID INTEGER, FOREIGN KEY (userDefinitionScreenID) REFERENCES GUIComponentDefinitionTable(internal_id ) ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
anonymous fields
Hello All, I've tried to use such scheme as described at : http://cvs.apache.org/viewcvs/db-ojb/xdocs/howto-use-anonymous-keys.xml?rev=HEAD&content-type=text/vnd.viewcvs-markup but I got such exception :(. In few words my prog contains 3 classes class A contains collection B collection C B contains collection B C contains String Name I put all these classes into a separate tables. tableA _id tableB _id - I use this field as foreign key for collection from class B, is it correct? Maybe I have to add additional field to the table B for having another key? _idA foreign key for collection from class A tableC _id _idA foreign key for collection from class A all this fields I've described as anonymous. in this exception userDefinitionScreenID - _idA CompositeControlDefinition - class B thank you . > org.apache.ojb.broker.OJBRuntimeException: Incorrect field reference > "userDefinitionScreenID" in [EMAIL PROTECTED] delete=false,cascade > retrieve=true,cascade store=false,is lazy=false,class of Items=class > efi.base.presentation.formdefinition.CompositeControlDefinition] > at > org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFieldDescriptors(Unknown > Source) > at org.apache.ojb.odmg.TransactionImpl.assertFkAssignment(Unknown Source) > at org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(Unknown Source) > at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:198) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:143) > at > efi.base.persistent.PersistentLayerManager.main(PersistentLayerManager.java:90) > rethrown as org.apache.ojb.broker.PersistenceBrokerException: Incorrect field > reference "userDefinitionScreenID" in [EMAIL PROTECTED] delete=false,cascade > retrieve=true,cascade store=false,is lazy=false,class of Items=class > efi.base.presentation.formdefinition.CompositeControlDefinition] > at org.apache.ojb.odmg.TransactionImpl.assertFkAssignment(Unknown Source) > at org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(Unknown Source) > at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:198) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:143) > at > efi.base.persistent.PersistentLayerManager.main(PersistentLayerManager.java:90) > rethrown as org.apache.ojb.broker.PersistenceBrokerException: Incorrect field > reference "userDefinitionScreenID" in [EMAIL PROTECTED] delete=false,cascade > retrieve=true,cascade store=false,is lazy=false,class of Items=class > efi.base.presentation.formdefinition.CompositeControlDefinition] > at org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(Unknown Source) > at org.apache.ojb.odmg.TransactionImpl.lock(Unknown Source) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:198) > at > efi.base.persistent.PersistentLayerManager.store(PersistentLayerManager.java:143) > at > efi.base.persistent.PersistentLayerManager.main(PersistentLayerManager.java:90) -- Best regards, Alexander mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: ODMG OQL
Hello Mahler, Please help me with this problem. if it's possible, of course. can I use Nested Queries in this OQL implementation? something like this: SELECT struct {name: S.name,courses: ( SELECT E FROM S.enrolled E WHERE E.Department=CS ) } FROM StudentExt S Or, on SQL 1. select * from users, products where users.id = products.createby and users.name = "Alex"; 2. select * from products where products.createby = (select user.id from users where user.id='Alex'); thank you. -- Best regards, Alexandermailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]