Re: [FAQ] Re: OJB conf with N servlets engines, and 1 DB
hi thomas, In a single web site + load-balanced/cluster environment, if I have more than 1 servlet engines (different VMs/HTTP sessions), each runs an OJB instance, and 1 shared database, what OJB mode should I configure to get the data cached (clear for all dirty cache automatically), synchronized, and obtain unique sequence? 1. Use optimistic locking (OL) to let OJB handle write conflicts between servlet engines. To use OL define a TIMESTAMP or INTEGER column and the respective Java attribute for it. In the field-descriptor of this attribute set the attribute locking=true i'm using PB to update the database. since it doesn't keep the state, i tried that PB only increments the INTEGER without generating the exception. should we manually i) start a new transaction ii) find the current object by the object to be modified's indentity iii) compare the 2 integers (in the current and new objects), and throw the exception, and rollback if they r not match iv) mark some children objects to be deleted recusively (fix the fact that PB doesn't delete children records) prior to calling store, and commit? does this approach safe within a transaction? thanks for your suggestions. i'll have a look at the JCS later :) 2. Think about caching. As you are using OL using a local cache will tend to hold more and more invalid data over time. This will decrease performance as more and more OL-Exceptions must be handled. you can either a) turn off caching complety by using the EmptyCacheImpl b) use the ObjectCachePerBrokerImpl and clear the local caches frequently. c) Use the JCS cache implementation (see OJB.properties). JCS provides synchronisation mechanisms for distributed caches. Please have a look at the JCS site for configuration details. 3. Use a SequenceManager that is safe across multiple JVMs. The NextVal based SequenceManagers or any other SequenceManager based on database mechanisms will be fine. I am not sure if the HighLowSeqMan is guaranteed to be safe across several JVMs Is that something like the C/S mode? but all HTTP requests go to the cluster of PB servers (no PB clients will exist in this case?) The OJB c/s mode was meant to separate the persistence broker layer from the Application layer (in your case the servlet container). But as servlet and EJB based apps are quite scalable by virtue of the respective containers, it just does not make much sense to introduce another layer. That's why we dropped the c/s mode. It won't be there in the 1.0 release. In fact it's already ereased from CVS! cheers, Thomas Thanks Thomas - 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]
Sorry title FW: Probs som jag skickat... should state MSSQLServer 200 and IDENTITY INSERT problem
JDO filter search
hi, i'm a newbie to JDO and OJB, obviously. I want to do a filter search using JDO API but I keep getting NullPointerException. When I refer to the features list, it says that OQL is currently not fully implemented. (Aggregations and Method Invocations). So does this line translated to filter search is not supported yet? If not, what does it refer to? Pls. advise. thank you. Teck Hooi, Lim Software Developer The Media Shoppe Sdn. Bhd. T06 Jalan Century Square Blok 2320, 63000 Cyberjaya Malaysia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
RE: how to manipulate many repository
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
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
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: Adding A New Component With A 1:1 Relationship
Thomas, Of course you're correct. I'd added foreign key constraints to all my tables. Once I removed them, OJB did the INSERT and managed all the keys for me, as you said. I apologize for missing that subtlety. Should I also remove foreign key constraints on many-to-many tables? I've got three of them in this schema. Will OJB handle those as nicely as the 1:1? ...I agree, there is a learning curve with OJB. O/R mapping is not trivial. But it is worth the effort. Once you mastered the learning curve you will ask yourself, how could I write database applications without an O/R tool?... - I totally agree with this statement. That's why I'm persisting with OJB, even if it makes me nervous about my release date. IMHO, two great benefits of an object/relational mapping layer are that they force SQL code out of the business objects and they allow CMP without entity EJBs. You can write J2EE without an app server; J2EE and EJB need not be synonymous. Thank you again for your fine work and timely advice. Sincerely, MOD --- Thomas Mahler [EMAIL PROTECTED] wrote: Hi Michael, Michael Duffy wrote: I have a newbie question, if you don't mind. Your advanced O/R tutorial shows a 1:1 mapping example with Article and ProductGroup classes. You've shown the table schemas (in German, but I follow you) and the repository_user.xml. All very good, of course. The repository XML for Article has a productGroupId that points to the ProductGroup key, and an instance of ProductGroup that is supposed to be owned by the Article. Now if I want to ask the broker to store a brand new Article, how do I do it? Is the productGroupId required to be set to an existing before I call broker.store(newArticle)? Depends on the database. If there is a FK constraint then yes. But as you can see from the table schema, there are no formal FK constraints. So, the productGroupId needs not to be filled. If I want to have a new ProductGroup for my Article, do I have to do this as a five-step transaction? 1. Create a new ProductGroup instance 2. Store the new ProductGroup instance 3. Get the latest ProductGroup instances's primary key 4. Create a new Article, using the PG primary key 5. Store the new Article No it's much easier, as OJB takes care of FK assigment automatically: 1. Create a new Article a 2. Create a new ProductGroup instance pg 3. call a.setProductGroup(pg) 4. store the new Article. OJB manages the FK assignment for you. If you have set auto-update=true on the productGroup reference-descriptor then OJB will also store the new PG on storing the new article! I'm sure it's my lack of understanding, because this feels very difficult. I'm still climbing that OJB learning curve. I agree, there is a learning curve with OJB. O/R mapping is not trivial. But it is worth the effort. Once you mastered the learning curve you will ask yourself, how could I write database applications without an O/R tool? cheers, Thomas Thank you for your work, help, and patience. Sincerely, MOD __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - 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] __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
performance
I am running into a huge performance issue and was hoping to get some guidance on where to start looking for a problem. Then mapping portion causing the problem deals with employees for a company. I currently have this modeled as a bi-directional 1:n mapping (Company has a collection of employees and Employee has a reference to its Company). Both sides of the association are set to be proxies (collection-proxy and reference-proxy). I then tested by loading 2 companies, one with 175 employees and another with 1524 (the results were pretty much the same querying the Employee object by its company). Accessing the employee collection on the first company took 1.5 secs to load. Accessing the employee collection on the second took 2 minutes and 5 secs to load. Thats not even close to linear, so I am thinking I must be doing something wrong. Any help troubleshooting this would be greatly appreciated. Below are the mappings for both classes. I am using the PersistentFieldMaxPerformanceImpl for the PersistenceFieldClass and a JNDI Datasource. !-- ### ## Company entity type mapping ### -- class-descriptor class=com.vignette.it.apps.server.domain.entities.Company table=COMPANY field-descriptor name=id column=COMP_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=parentId column=PRNT_COMP_ID jdbc-type=INTEGER / field-descriptor name=pending column=PENDING_APPRVL_FLG jdbc-type=INTEGER conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo nversion / field-descriptor name=name column=NAME jdbc-type=VARCHAR / field-descriptor name=aliases column=ALIASES jdbc-type=VARCHAR / field-descriptor name=numberOfVignetteSites column=NUM_OF_VIGN_SITES jdbc-type=INTEGER / field-descriptor name=annualRevenueAmount column=ANNUAL_REV jdbc-type=DOUBLE / field-descriptor name=annualRevenueCurrencyId column=ANNUAL_REV_CURR_ID jdbc-type=INTEGER / field-descriptor name=potentialOpportunityAmount column=POTNL_OPP jdbc-type=DOUBLE / field-descriptor name=potentialOpportunityCurrencyId column=POTNL_OPP_CURR_ID jdbc-type=INTEGER / field-descriptor name=fortuneListId column=FORT_LIST_ID jdbc-type=INTEGER / field-descriptor name=geographyId column=GEO_ID jdbc-type=INTEGER / field-descriptor name=customerStatusId column=CUST_PROD_STAT_ID jdbc-type=INTEGER / field-descriptor name=createdBy column=CRTD_BY jdbc-type=VARCHAR / field-descriptor name=createdDate column=CRTD_DT jdbc-type=TIMESTAMP conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest ampFieldConversion / field-descriptor name=modifiedBy column=CHGD_BY jdbc-type=VARCHAR / field-descriptor name=modifiedDate column=CHGD_DT jdbc-type=TIMESTAMP conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest ampFieldConversion / reference-descriptor name=parent class-ref=com.vignette.it.apps.server.domain.entities.Company proxy=true foreignkey field-ref=parentId/ /reference-descriptor reference-descriptor name=annualRevenueCurrency class-ref=com.vignette.it.apps.server.domain.entities.Currency proxy=true foreignkey field-ref=annualRevenueCurrencyId/ /reference-descriptor reference-descriptor name=potentialOpportunityCurrency class-ref=com.vignette.it.apps.server.domain.entities.Currency proxy=true foreignkey field-ref=potentialOpportunityCurrencyId/ /reference-descriptor reference-descriptor name=fortuneList
RE: performance
Hi My opinion is basically to take a look at your sourcecode first and don't forget to index your tables. For me, for my typical situation/project I can tell next details : My Oracle 8 database schema for test contains ~ 15 tables with more than 300 total defined columns, minimum indexed, with 1:n and n:m relations using indirection tables, and a total of more than 200.000 entries and a complete test suite where full schema is parsed takes under 20 seconds. Some development advice is to take care to create in your source code one PBKey/PersistenceBroker instance and to cache this for later usage. Regards, Cristian -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Dienstag, 18. März 2003 15:03 To: OJB Users List (E-mail) Subject: performance I am running into a huge performance issue and was hoping to get some guidance on where to start looking for a problem. Then mapping portion causing the problem deals with employees for a company. I currently have this modeled as a bi-directional 1:n mapping (Company has a collection of employees and Employee has a reference to its Company). Both sides of the association are set to be proxies (collection-proxy and reference-proxy). I then tested by loading 2 companies, one with 175 employees and another with 1524 (the results were pretty much the same querying the Employee object by its company). Accessing the employee collection on the first company took 1.5 secs to load. Accessing the employee collection on the second took 2 minutes and 5 secs to load. Thats not even close to linear, so I am thinking I must be doing something wrong. Any help troubleshooting this would be greatly appreciated. Below are the mappings for both classes. I am using the PersistentFieldMaxPerformanceImpl for the PersistenceFieldClass and a JNDI Datasource. !-- ### ## Company entity type mapping ### -- class-descriptor class=com.vignette.it.apps.server.domain.entities.Company table=COMPANY field-descriptor name=id column=COMP_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=parentId column=PRNT_COMP_ID jdbc-type=INTEGER / field-descriptor name=pending column=PENDING_APPRVL_FLG jdbc-type=INTEGER conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo nversion / field-descriptor name=name column=NAME jdbc-type=VARCHAR / field-descriptor name=aliases column=ALIASES jdbc-type=VARCHAR / field-descriptor name=numberOfVignetteSites column=NUM_OF_VIGN_SITES jdbc-type=INTEGER / field-descriptor name=annualRevenueAmount column=ANNUAL_REV jdbc-type=DOUBLE / field-descriptor name=annualRevenueCurrencyId column=ANNUAL_REV_CURR_ID jdbc-type=INTEGER / field-descriptor name=potentialOpportunityAmount column=POTNL_OPP jdbc-type=DOUBLE / field-descriptor name=potentialOpportunityCurrencyId column=POTNL_OPP_CURR_ID jdbc-type=INTEGER / field-descriptor name=fortuneListId column=FORT_LIST_ID jdbc-type=INTEGER / field-descriptor name=geographyId column=GEO_ID jdbc-type=INTEGER / field-descriptor name=customerStatusId column=CUST_PROD_STAT_ID jdbc-type=INTEGER / field-descriptor name=createdBy column=CRTD_BY jdbc-type=VARCHAR / field-descriptor name=createdDate column=CRTD_DT jdbc-type=TIMESTAMP conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest ampFieldConversion / field-descriptor name=modifiedBy column=CHGD_BY jdbc-type=VARCHAR / field-descriptor name=modifiedDate column=CHGD_DT jdbc-type=TIMESTAMP conversion=org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest ampFieldConversion / reference-descriptor name=parent
RE: performance
Yeah, that app-sever is OK for certain things and just piss-poor for others (but I guess what product isn't like that). Its Entity Bean support is not the best around (although I have heard that using TopLink as its CMP engine is a pretty good solution). Quick OT question. How in the world are you modeling a CRM app with only 15 tables? Also forgot to mention that I have set up assocaition tables for M:N relationships, but not for 1:N. 1:N are modeled with a FK on the one-side table. That is faster to access from a relational perspective. -Original Message- From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 8:43 AM To: 'OJB Users List' Subject: RE: performance Hi, surprising how much similarity, we are doing also some CRM and we used some commercial appsrv( like t3://myserver:7001 ;-) ) till we become very piss off because of entity ejb performance and now we will migrate to tomcat and ojb ( currently 4.1.18/1.0rc1 ) and our performance test are till now very satisfactory ... Regards, Cristian -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Dienstag, 18. März 2003 15:30 To: 'OJB Users List' Subject: RE: performance Thanks for the response. First the database schema is completely normalized. And unfortunately I cant work with just 15 tables; this is the begining of a CRM app and phase one alone has over 300 tables. All PK and FK are also set up as indexes. Not that it (should) matter much, but we also use Oracle 8i. As for the source code, this is just a simple test class (code below) and as such, there is only one PB instance. This is not yet even incurring the overhead of the EJB calls. public class TestCompanyMappings { private static final Logger log = Logger.getRootLogger(); public TestCompanyMappings() { System.setProperty( OJB.properties, properties/OJB.properties ); System.setProperty( Context.PROVIDER_URL, t3://myserver:7001 ); System.setProperty( Context.INITIAL_CONTEXT_FACTORY, weblogic.jndi.WLInitialContextFactory ); } public static void main( String[] args ) { TestCompanyMappings me = new TestCompanyMappings(); me.execute(); } private void execute() { PersistenceBroker broker = null; Criteria crit = null; crit = new Criteria(); crit.addEqualTo( id, new Integer(1) ); Query query = new QueryByCriteria( Company.class, crit ); try { broker = PersistenceBrokerFactory.defaultPersistenceBroker(); log.debug( Starting query ); java.util.Collection extent = broker.getCollectionByQuery( query ); log.debug( Done query; iterating ); java.util.Iterator iter = extent.iterator(); while (iter.hasNext()) { display( (Company)iter.next() ); } log.debug( Done iterating ); } catch( Throwable t ) { log.error( Error occurred, t ); } finally { if (broker != null) { try { broker.close(); } catch( Throwable t ) {} } } } private void display( Company company ) { System.out.println( *** ); System.out.println( ID : + company.getId() ); System.out.println( Name : + company.getName() ); System.out.println( *** ); log.debug( Forcing load of employees ); System.out.println( First contact last-name : + ((Contact)company.getEmployees().iterator().next()).getPerson().getLastName( ) ); log.debug( Employees loaded ); } } -Original Message- From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 8:18 AM To: 'OJB Users List' Subject: RE: performance Hi My opinion is basically to take a look at your sourcecode first and don't forget to index your tables. For me, for my typical situation/project I can tell next details : My Oracle 8 database schema for test contains ~ 15 tables with more than 300 total defined columns, minimum indexed, with 1:n and n:m relations using indirection tables, and a total of more than 200.000 entries and a complete test suite where full schema is parsed takes under 20 seconds. Some development advice is to take care to create in your source code one PBKey/PersistenceBroker instance and to cache this for later usage. Regards, Cristian -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Dienstag, 18. März 2003 15:03 To: OJB Users List (E-mail) Subject: performance I am running into a huge performance issue and was hoping to get some guidance on where to start looking for a problem. Then
[OJB 0.9.8] [JDO] Retreive PK
Hi all I am trying the JDO API with OJB and MySQL. When I make persistence whith a bean (Application here), the insertion is OK but the object don' t retreive the value of the primary key [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false [org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Create PersistenceBroker instance pool, pool configuration was {whenExhaustedAction=0, maxIdle=-1, maxActive=100, maxWait=2000, numTestsPerEvictionRun=10, testWhileIdle=false, testOnReturn=false, timeBetweenEvictionRunsMillis=-1, minEvictableIdleIimeMillis=60, testOnBorrow=false} [DEFAULT] INFO: OJB Descriptor Repository: file:/D:/SourcesJava/persistance/dist/ojb/src/repository.xml [DEFAULT] INFO: ...Finished parsing. Took 1452 msecs [DEFAULT] INFO: OJB Descriptor Repository: file:/D:/SourcesJava/persistance/dist/ojb/src/repository.xml [DEFAULT] INFO: ...Finished parsing. Took 180 msecs [org.apache.ojb.broker.util.sequence.SequenceManagerFactory] INFO: Use sequence manager class: class org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create connection pool for JdbcDescriptorKey 381060771 [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create new connection pool for org.apache.ojb.broker.metadata.JdbcConnectionDescriptor, used descriptor: JdbcConnectionDescriptor DBMS:MySQL DRIVER: com.mysql.jdbc.Driver PROTOCOL: jdbc SUBPROTOCOL: mysql DBALIAS: //127.0.0.1/persist USERNAME: PASSWORD: EAGER RELEASE: false pool configuration was: {whenExhaustedAction=0, maxIdle=-1, maxActive=21, maxWait=5000, numTestsPerEvictionRun=10, testWhileIdle=false, testOnReturn=false, timeBetweenEvictionRunsMillis=-1, minEvictableIdleIimeMillis=60, testOnBorrow=true} [org.apache.ojb.broker.accesslayer.JdbcAccess] DEBUG: executeQuery : Query from class fr.cgbi.samples.persistence.ojb.Application where null [JDO] DEBUG: OjbStoreManager.flush: end, err=false [JDO] DEBUG: OjbStoreConnector.commit [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false [JDO] DEBUG: OjbStoreManager.flush: fr.cgbi.samples.persistence.ojb.Application{0}, P_NEW [JDO] DEBUG: OjbStoreManager.insert [org.apache.ojb.broker.accesslayer.JdbcAccess] DEBUG: executeInsert : [EMAIL PROTECTED] [JDO] DEBUG: OjbStoreManager.flush: end, err=false [JDO] DEBUG: OjbStoreConnector.commit 0 [main] INFO fr.cgbi.commons.persistence.testcase.JDOPersistenceManagerTest - app.getId()=0 -- PRIMARY KEY I had inserted the internal tables of OJB but the insertion return the same result :-( Thanks for your help Alexandre Touret __ Alexandre Touret CGBI 69 Boulevard Galliéni 92130 Issy les Moulineaux tel.: 01/55/95/53/95Poste: 5395 mailto:[EMAIL PROTECTED]
[jBoss deployment]: example ejb beans not deploying
Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: performance
Yah, - TopLink, another fun for another money, I think the days of giant price schemas for software products are counted fast, friends know why ;-), but here is not the place to loose time with this. - 15 tables per module functionality, - ok, for 1:N I used the same FK design, correct success to ojb guys, they rock ... -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Dienstag, 18. März 2003 15:50 To: 'OJB Users List' Subject: RE: performance Yeah, that app-sever is OK for certain things and just piss-poor for others (but I guess what product isn't like that). Its Entity Bean support is not the best around (although I have heard that using TopLink as its CMP engine is a pretty good solution). Quick OT question. How in the world are you modeling a CRM app with only 15 tables? Also forgot to mention that I have set up assocaition tables for M:N relationships, but not for 1:N. 1:N are modeled with a FK on the one-side table. That is faster to access from a relational perspective. -Original Message- From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 8:43 AM To: 'OJB Users List' Subject: RE: performance Hi, surprising how much similarity, we are doing also some CRM and we used some commercial appsrv( like t3://myserver:7001 ;-) ) till we become very piss off because of entity ejb performance and now we will migrate to tomcat and ojb ( currently 4.1.18/1.0rc1 ) and our performance test are till now very satisfactory ... Regards, Cristian -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Dienstag, 18. März 2003 15:30 To: 'OJB Users List' Subject: RE: performance Thanks for the response. First the database schema is completely normalized. And unfortunately I cant work with just 15 tables; this is the begining of a CRM app and phase one alone has over 300 tables. All PK and FK are also set up as indexes. Not that it (should) matter much, but we also use Oracle 8i. As for the source code, this is just a simple test class (code below) and as such, there is only one PB instance. This is not yet even incurring the overhead of the EJB calls. public class TestCompanyMappings { private static final Logger log = Logger.getRootLogger(); public TestCompanyMappings() { System.setProperty( OJB.properties, properties/OJB.properties ); System.setProperty( Context.PROVIDER_URL, t3://myserver:7001 ); System.setProperty( Context.INITIAL_CONTEXT_FACTORY, weblogic.jndi.WLInitialContextFactory ); } public static void main( String[] args ) { TestCompanyMappings me = new TestCompanyMappings(); me.execute(); } private void execute() { PersistenceBroker broker = null; Criteria crit = null; crit = new Criteria(); crit.addEqualTo( id, new Integer(1) ); Query query = new QueryByCriteria( Company.class, crit ); try { broker = PersistenceBrokerFactory.defaultPersistenceBroker(); log.debug( Starting query ); java.util.Collection extent = broker.getCollectionByQuery( query ); log.debug( Done query; iterating ); java.util.Iterator iter = extent.iterator(); while (iter.hasNext()) { display( (Company)iter.next() ); } log.debug( Done iterating ); } catch( Throwable t ) { log.error( Error occurred, t ); } finally { if (broker != null) { try { broker.close(); } catch( Throwable t ) {} } } } private void display( Company company ) { System.out.println( *** ); System.out.println( ID : + company.getId() ); System.out.println( Name : + company.getName() ); System.out.println( *** ); log.debug( Forcing load of employees ); System.out.println( First contact last-name : + ((Contact)company.getEmployees().iterator().next()).getPerson().getLastName( ) ); log.debug( Employees loaded ); } } -Original Message- From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 8:18 AM To: 'OJB Users List' Subject: RE: performance Hi My opinion is basically to take a look at your sourcecode first and don't forget to index your tables. For me, for my typical situation/project I can tell next details : My Oracle 8 database schema for test contains ~ 15 tables with more than 300 total defined columns, minimum indexed, with 1:n and n:m relations using indirection tables, and a total of more than 200.000 entries and a complete test suite where full schema is
Re: [jBoss deployment]: example ejb beans not deploying
Hi Phil, I tested CVS with jboss 3.0.4 + 3.0.6 using sapDB. I use the same directory structure: ojb.sar |---META-INF | | | MANIFEST.MF, jboss-service.xml db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb config files Did you use current build.xml/xdoclet-build.xml file, I made some minor changes (as far as I know;-)) regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:57 PM Subject: [jBoss deployment]: example ejb beans not deploying Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - 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
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,
Re: Query against Collection with more than one addEqualTo statement.
The empty collection result makes perfect sense if the default behavior is to AND criteria together. None of your articles have both names set (exclusion at work), so nothing comes back. Aren't you trying to say Give me all the articles where name = 'Article 1' OR name = 'Article 2'? If I understand correctly, I think you want to use either the addOrCriteria or addIn methods. - MOD --- Gregor Heinze [EMAIL PROTECTED] wrote: For the sake of simplicity, I refer to the class model from the tutorial Advanced Object Relational Mapping techniques to explain my problem. It seems to be quite simple but I wasn't able to figure it out correctly. All I want to do is to get all ProductGroup's which have an Article with the articleName Article 1 _and_ an Article with the articleName Article 2 in its allArticlesInGroup Vector. Using the PersistenceBroker API I wrote the following: Criteria crit = new Criteria(); crit.addEqualTo(allArticlesInGroup.articleName, Article 1); crit.addEqualTo(allArticlesInGroup.articleName, Article 2); Query q = QueryFactory.newQuery(ProductGroup.class, crit); Unfortunately this approach does not work and I always get an empty result collection. Using only one addEqualTo statement works as expected but using two of them won't. Anyone has an idea how to do this? Any help is appreciated! Thanks in advanced, Gregor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Query against Collection with more than one addEqualTo statement.
Thanks for your fast reply. Maybe I was unclear? It's not the articles I'm about it's the product groups containing the articles. So I'm trying to say: Give me all product groups that have an article where article.name = 'Article 1' AND an article where article.name = 'Article 2'. Or to say it in Java, a match would be if (productGroup.allArticlesInGroup.contains(Article 1) productGroup.allArticlesInGroup.contains(Article 2)) -Ursprüngliche Nachricht- Von: Michael Duffy [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 18. März 2003 16:31 An: OJB Users List Betreff: Re: Query against Collection with more than one addEqualTo statement. The empty collection result makes perfect sense if the default behavior is to AND criteria together. None of your articles have both names set (exclusion at work), so nothing comes back. Aren't you trying to say Give me all the articles where name = 'Article 1' OR name = 'Article 2'? If I understand correctly, I think you want to use either the addOrCriteria or addIn methods. - MOD --- Gregor Heinze [EMAIL PROTECTED] wrote: For the sake of simplicity, I refer to the class model from the tutorial Advanced Object Relational Mapping techniques to explain my problem. It seems to be quite simple but I wasn't able to figure it out correctly. All I want to do is to get all ProductGroup's which have an Article with the articleName Article 1 _and_ an Article with the articleName Article 2 in its allArticlesInGroup Vector. Using the PersistenceBroker API I wrote the following: Criteria crit = new Criteria(); crit.addEqualTo(allArticlesInGroup.articleName, Article 1); crit.addEqualTo(allArticlesInGroup.articleName, Article 2); Query q = QueryFactory.newQuery(ProductGroup.class, crit); Unfortunately this approach does not work and I always get an empty result collection. Using only one addEqualTo statement works as expected but using two of them won't. Anyone has an idea how to do this? Any help is appreciated! Thanks in advanced, Gregor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Optimistic Integer locking w/o increment
Hi, We are using Optimistic integer locking on some tables. However, we want to do the incrementing in dbms triggers. Then we can have a dbms trigger that throws an exception if the locking column has changed (ie another user has updated the row). If the column is unchanged then the trigger increments it. This makes it simpler to have multiple tools/languages updating the dbms. Where should I look in OJB to keep the optimistic locking checks but for OJB not to update the version column. Thanks Dave -- David Warnock, Sundayta Ltd. http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Query against Collection with more than one addEqualTo statement.
A little mistake in the Java statement. It should be if (productGroup.allArticlesInGroup.contains(a1) productGroup.allArticlesInGroup.contains(a2)) Where a1.articleName = Article 1 and a2.articleName = Article 2. Of course we've to overwrite equals to compare articles by their name ... Whatever, I hope it's clear now. -Ursprüngliche Nachricht- Von: Gregor Heinze [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 18. März 2003 16:41 An: OJB Users List Betreff: AW: Query against Collection with more than one addEqualTo statement. Thanks for your fast reply. Maybe I was unclear? It's not the articles I'm about it's the product groups containing the articles. So I'm trying to say: Give me all product groups that have an article where article.name = 'Article 1' AND an article where article.name = 'Article 2'. Or to say it in Java, a match would be if (productGroup.allArticlesInGroup.contains(Article 1) productGroup.allArticlesInGroup.contains(Article 2)) -Ursprüngliche Nachricht- Von: Michael Duffy [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 18. März 2003 16:31 An: OJB Users List Betreff: Re: Query against Collection with more than one addEqualTo statement. The empty collection result makes perfect sense if the default behavior is to AND criteria together. None of your articles have both names set (exclusion at work), so nothing comes back. Aren't you trying to say Give me all the articles where name = 'Article 1' OR name = 'Article 2'? If I understand correctly, I think you want to use either the addOrCriteria or addIn methods. - MOD --- Gregor Heinze [EMAIL PROTECTED] wrote: For the sake of simplicity, I refer to the class model from the tutorial Advanced Object Relational Mapping techniques to explain my problem. It seems to be quite simple but I wasn't able to figure it out correctly. All I want to do is to get all ProductGroup's which have an Article with the articleName Article 1 _and_ an Article with the articleName Article 2 in its allArticlesInGroup Vector. Using the PersistenceBroker API I wrote the following: Criteria crit = new Criteria(); crit.addEqualTo(allArticlesInGroup.articleName, Article 1); crit.addEqualTo(allArticlesInGroup.articleName, Article 2); Query q = QueryFactory.newQuery(ProductGroup.class, crit); Unfortunately this approach does not work and I always get an empty result collection. Using only one addEqualTo statement works as expected but using two of them won't. Anyone has an idea how to do this? Any help is appreciated! Thanks in advanced, Gregor - 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]
FK to non-PK relationship
I saw posts on the following subject, but didn't see any replies: If a persistent class A has a reference to a persistent class B, can the foreign key in class B point to a field that is NOT the primary key in class A? If my understanding is correct it's impossible to do right now, at least I can't see a way to declare such a relationship in the repository (I concede that such situations shouldn't occur, but consider legacy data). Anyway, I thought that perhaps as a quick fix, the concept of QueryCustomizer can be extended to reference-descriptors as well. This way the user can programmatically adjust the query and set the related fields. Cheers, --Bill. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [jBoss deployment]: example ejb beans not deploying
Hi Armin, The problem went away when I upgraded to jBoss-3.0.6. One that I noticed in build-xdoclet.xml (although it didn't end up being the cause of the problem) is that the MANIFEST.MF classpath syntax is supposed to be Class-Path: xxx.jar yyy.jar rather than classpath: xxx.jar yyy.jar To be more consistent wouldn't it be better to include all the jars that the beans are dependent on, like: Class-Path: db-ojb-1.0.rc2.jar db-ojb-1.0.rc2-junit.jar as well as the libs required (like commons-lang-1.0-mod.jar etc.) in the build-xdoclet.xml file. At the moment only the junit jar is listed. Thanks, Phil Armin Waibel wrote: Hi Phil, I tested CVS with jboss 3.0.4 + 3.0.6 using sapDB. I use the same directory structure: ojb.sar |---META-INF | | | MANIFEST.MF, jboss-service.xml db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb config files Did you use current build.xml/xdoclet-build.xml file, I made some minor changes (as far as I know;-)) regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:57 PM Subject: [jBoss deployment]: example ejb beans not deploying Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - 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: [jBoss deployment]: example ejb beans not deploying
BTW: A nice reference on deployment packaging can be found at: http://www.theserverside.com//resources/articles/J2EE-Deployment/article.html Phil Phil Warrick wrote: Hi Armin, The problem went away when I upgraded to jBoss-3.0.6. One that I noticed in build-xdoclet.xml (although it didn't end up being the cause of the problem) is that the MANIFEST.MF classpath syntax is supposed to be Class-Path: xxx.jar yyy.jar rather than classpath: xxx.jar yyy.jar To be more consistent wouldn't it be better to include all the jars that the beans are dependent on, like: Class-Path: db-ojb-1.0.rc2.jar db-ojb-1.0.rc2-junit.jar as well as the libs required (like commons-lang-1.0-mod.jar etc.) in the build-xdoclet.xml file. At the moment only the junit jar is listed. Thanks, Phil Armin Waibel wrote: Hi Phil, I tested CVS with jboss 3.0.4 + 3.0.6 using sapDB. I use the same directory structure: ojb.sar |---META-INF | | | MANIFEST.MF, jboss-service.xml db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb config files Did you use current build.xml/xdoclet-build.xml file, I made some minor changes (as far as I know;-)) regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:57 PM Subject: [jBoss deployment]: example ejb beans not deploying Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - 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: Query on composite pattern
hi dariusz, the problem is that Foo points to Test which has no collection descriptor named 'test' not even a field with this name. have you tried modifying getAttributeDescriptorsForPath so it accepts the path hints ? if not, can you please send me a test case for this pattern. jakob Dariusz Kies wrote: Hi, Here is the sql for 3: [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT A0.ID,A0.ID_TEST FROM FI.T_FOO A0,FI.T_TEST_SUITE A1 WHERE A0.ID_TEST=A1.ID AND (caseName = ? ) Notice that there isn't the column name for the caseName attribute and there isn't join with FI.T_TEST_CASE. I debug a little and I found that a problem is in the class org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement, method getTableAlias and call descriptors = getRoot().cld.getAttributeDescriptorsForPath(aPath); // line 655 This call return only one element:[EMAIL PROTECTED] delete=false,cascade retrieve=true,cascade store=false,is lazy=false,class of Items=class Test]] It should return three descriptors: TestSuite, TestCase and caseName. Method getAttributeDescriptorsForPath don't consider the addPathClass that's way it can't return the good descriptors. Thanks for help Dariusz Kies --- Jakob Braeuchi [EMAIL PROTECTED] wrote: hi dariusz, what is the problem with sample 3 ? can you pleas post the sql or an error message ? jakob Dariusz Kies wrote: Hi, I have a problem to query on composite pattern in OJB (db-ojb-1.0.rc1). Let's assume that I have Test composite pattern from JUnit in OJB: class-descriptor class=Test ... extent-class class-ref=TestCase / extent-class class-ref=TestSuite / field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / /class-descriptor class-descriptor class=TestCase ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / field-descriptor name=caseName jdbc-type=VARCHAR ... / /class-descriptor class-descriptor class=TestSuite ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / field-descriptor name=suiteName jdbc-type=VARCHAR ... / collection-descriptor name=test element-class-ref=Test ... inverse-foreignkey field-ref=idTest/ /collection-descriptor /class-descriptor class-descriptor class=Foo ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / reference-descriptor name=test class-ref=Test ... foreignkey field-ref=idTest/ /reference-descriptor /class-descriptor 1. This works ok: Criteria crit = new Criteria(); crit.addEqualTo(test.caseName, test 1); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(test, TestCase.class); Collection results = broker.getCollectionByQuery(query); 2. This don't work: Criteria crit = new Criteria(); crit.addEqualTo(test.test.caseName, test 2); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(test, TestSuite.class); // first test query.addPathClass(test, TestCase.class); // second test Collection results = broker.getCollectionByQuery(query); 3. Still doesn't work: class-descriptor class=Foo ... field-descriptor name=id primarykey=true autoincrement=true ... / reference-descriptor name=aTest class-ref=Test ... foreignkey field-ref=idTest/ /reference-descriptor /class-descriptor Criteria crit = new Criteria(); crit.addEqualTo(aTest.test.caseName, test 3); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(aTest, TestSuite.class); query.addPathClass(test, TestCase.class); Collection results = broker.getCollectionByQuery(query); Can I query on composite pattern in OJB? Thanks for help Dariusz Kies __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com - 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] __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - 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[2]: AW: Query against Collection with more than one addEqualTo statement.
Hello Jakob, Thanks a lot, this is exactly what I wanted. Thanks again, Gregor JB hi gregor, JB imo this is a good example for user alias: JB you'll need two criteria because an article can not have name1 and name2 : JB Criteria crit1 = new Criteria(); JB Criteria crit2 = new Criteria(); JB crit1.setAlias(crit1); JB crit1.addEqualTo(allArticlesInGroup.articleName,Article 1); JB crit2.setAlias(crit2); JB crit2.addEqualTo(allArticlesInGroup.articleName,Article 2); JB crit1.addAndCriteria(crit2); JB Query q = QueryFactory.newQuery(ProductGroup.class,crit1); JB hth JB jakob JB Gregor Heinze wrote: Thanks for your fast reply. Maybe I was unclear? It's not the articles I'm about it's the product groups containing the articles. So I'm trying to say: Give me all product groups that have an article where article.name = 'Article 1' AND an article where article.name = 'Article 2'. Or to say it in Java, a match would be if (productGroup.allArticlesInGroup.contains(Article 1) productGroup.allArticlesInGroup.contains(Article 2)) -Ursprüngliche Nachricht- Von: Michael Duffy [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 18. März 2003 16:31 An: OJB Users List Betreff: Re: Query against Collection with more than one addEqualTo statement. The empty collection result makes perfect sense if the default behavior is to AND criteria together. None of your articles have both names set (exclusion at work), so nothing comes back. Aren't you trying to say Give me all the articles where name = 'Article 1' OR name = 'Article 2'? If I understand correctly, I think you want to use either the addOrCriteria or addIn methods. - MOD --- Gregor Heinze [EMAIL PROTECTED] wrote: For the sake of simplicity, I refer to the class model from the tutorial Advanced Object Relational Mapping techniques to explain my problem. It seems to be quite simple but I wasn't able to figure it out correctly. All I want to do is to get all ProductGroup's which have an Article with the articleName Article 1 _and_ an Article with the articleName Article 2 in its allArticlesInGroup Vector. Using the PersistenceBroker API I wrote the following: Criteria crit = new Criteria(); crit.addEqualTo(allArticlesInGroup.articleName, Article 1); crit.addEqualTo(allArticlesInGroup.articleName, Article 2); Query q = QueryFactory.newQuery(ProductGroup.class, crit); Unfortunately this approach does not work and I always get an empty result collection. Using only one addEqualTo statement works as expected but using two of them won't. Anyone has an idea how to do this? Any help is appreciated! Thanks in advanced, Gregor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Associations trouble
I'm having some problems understanding how to implement the 1:1 and 1:n mappings in OJB (1.0rc1). I'm trying to use collections and foreignkey mappings to represent my DB. For example, it appears that the collection in my BillingControl class does not get propogated (debug log shows size of 0), although I am able to do simple queries w/ Critieria (for example, the authentication is done by looking up account_number and customer_id in billing_control). I can also get things such as all_so_header where customer_id = ?, but I would like it to be automatic via the repository. Any help would be greatly appreciated. As you can see, there is actually a few different joins needed to get things. The DDL is below: create table billing_control ( account_number varchar(20) NOT NULL, customer_id varchar(10) NOT NULL, primary key (account_number) ); create table all_so_header ( customer_id varchar(10) not null, order_id varchar(10) not null, ckt_order varchar(20), end_user_name varchar(80), product_id varchar(6), desired_due_date date, status varchar(10), primary key (customer_id, order_id), foreign key (customer_id) references billing_control(customer_id) ); create table ckt_order ( order_id varchar(10) not null, system_id varchar(10) not null, ckt_ser_service_code varchar(2), ckt_ser_service_modifier varchar(2), ckt_type varchar(1), issue integer, ckt_fac_location_a varchar(11), ckt_fac_location_z varchar(11), ckt_fac_facility_type varchar(6), ckt_fac_designator varchar(10), implementation_contact varchar(40), ckt_ser_serial_no varchar(10), primary key(order_id, system_id), foreign key(order_id) references all_so_header(order_id) ); create table circuit_ckt_locations ( system_id varchar(10) not null, location_a varchar(11), location_z varchar(11), primary key(system_id), foreign key(system_id) references ckt_order(system_id) ); create table service_code_dict ( service_code varchar(2) not null, service_modifier varchar(2), description varchar(60), primary key(service_code), foreign key(service_code) references ckt_order(ckt_ser_service_code), foreign key(service_modifier) references ckt_order(ckt_ser_service_modifier) ); My repository_user.xml is: class-descriptor class=com.enventistelecom.custportal.businessobjects.BillingControl table=billing_control field-descriptor id=1 name=accountNumber column=account_number jdbc-type=VARCHAR primarykey=true / field-descriptor id=2 name=customerId column=customer_id jdbc-type=VARCHAR primary-key=true / collection-descriptor name=allSoHeaders element-class-ref=com.enventistelecom.custportal.businessobjects.AllSoHeader inverse-foreignkey field-ref=customerId/ /collection-descriptor /class-descriptor class-descriptor class=com.enventistelecom.custportal.businessobjects.AllSoHeader table=all_so_header field-descriptor name=orderId column=order_id jdbc-type=VARCHAR primarykey=true / field-descriptor name=cktOrder column=ckt_order jdbc-type=VARCHAR / field-descriptor name=customerId column=customer_id jdbc-type=VARCHAR / field-descriptor name=endUserName column=end_user_name jdbc-type=VARCHAR / field-descriptor name=productId column=product_id jdbc-type=VARCHAR / field-descriptor name=desiredDueDate column=desired_due_date jdbc-type=DATE / field-descriptor name=status column=status jdbc-type=VARCHAR / reference-descriptor name=customerId class-ref=com.enventistelecom.custportal.businessobjects.BillingControl foreignkey field-ref=customerId/ /reference-descriptor collection-descriptor name=allOrders auto-retrieve=true element-class-ref=com.enventistelecom.custportal.businessobjects.CktOrder inverse-foreignkey field-ref=orderId/ /collection-descriptor /class-descriptor class-descriptor class=com.enventistelecom.custportal.businessobjects.CktOrder table=ckt_order field-descriptor id=1 name=orderId column=order_id jdbc-type=VARCHAR primarykey=true / field-descriptor id=2 name=systemId column=system_id jdbc-type=VARCHAR primarykey=true / field-descriptor id=3 name=cktSerServiceCode column=ckt_ser_service_code jdbc-type=VARCHAR / field-descriptor id=4 name=cktSerServiceModifier column=ckt_ser_service_modifier jdbc-type=VARCHAR / field-descriptor id=5 name=cktType column=ckt_type jdbc-type=VARCHAR / field-descriptor id=6 name=issue column=issue jdbc-type=INTEGER / field-descriptor id=7 name=cktFacLocationA column=ckt_fac_location_A jdbc-type=VARCHAR / field-descriptor id=8 name=cktFacLocationZ column=ckt_fac_location_Z jdbc-type=VARCHAR / field-descriptor id=9
RE: Deploy OJB in WebLogic Server
Christophe: I started my prototype with CMP. With the help of xdoclet, it still takes much longer time to create and maintain a CMP than OJB. The line of code for CMP (with xdoclet) is twice as much as OJB. Also the developer must know how CMP behaves under different configuration in different application servers. CMP doesn't give the enough power of SQL, for example, there is no like for EJBQL. For OJB, I'm using Torque to generate repository.xml, VO object and ojb code. About performance, I used Grinder for load testing. The HTTP request/response time is very minimal under 25 simulated users who are doing CRUD functions. I can give you the data if you want. My only concern is that the select all call is quite slow and I'm wondering if there is any mothed in OJB API that will return a configurable amount of records. But for create, update, delete and select by calls, performance is very good. Cheers, Lucy -Original Message- From: Christophe Lombart [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 4:37 PM To: OJB Users List Subject: Re: Deploy OJB in WebLogic Server Just to complete the information provided by Lucy, you can find here how to deploy OJB (PB) on weblogic. It is quite similar to Jboss. I think Thomas should be interested to receive this small install guide for weblogic (Tested only on Weblogic 7): 1. Add the OJB jar files and depedencies into the Weblogic classpath. 2. Compile the following classes (see at the end of this mail) and add them to the weblogic classpath. 3. Register via the weblogic console the startup class (OjbPbStartup). The JNDI name and the OJB.properties file path can be specified as parameters in this startup class (see the code). 4. As usual create the connection pool and the datasource. 5. Check the following entries in the OJB.properties : ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa nagedImpl OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager JTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.WeblogicTr ansactionManagerFactory 6. Modify the connection information in the repository.xml (specify the datasource name): jdbc-connection-descriptor jcd-alias=default default-connection=true platform=Hsqldb jdbc-level=2.0 jndi-datasource-name=datasource_demodb eager-release=false batch-mode=false useAutoCommit=0 ignoreAutoCommitExceptions=false sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl attribute attribute-name=grabSize attribute-value=20/ /sequence-manager /jdbc-connection-descriptor 7. Write a session bean similar to thoses provided for the JBOSS samples. I'm interesting to know if someone make a small comparaison between EJB CMP 2.0 and OJB in term of performance, development cost, lifecycle, cache management... It should interesting for my current project. Thanks, Christophe -- OjbPbFactory -- package org.apache.ojb.weblogic; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF; public interface OjbPbFactory { public static String DEFAULT_JNDI_NAME = PBFactory; public PersistenceBrokerFactoryIF getInstance(); } -- OjbPbFactoryImpl -- package org.apache.ojb.weblogic; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF; /** * PB Factory wrapper class for weblogic * */ public class OjbPbFactoryImpl implements OjbPbFactory { public PersistenceBrokerFactoryIF getInstance() { return PersistenceBrokerFactoryFactory.instance(); } } -- OjbStartup -- package org.apache.ojb.weblogic; import javax.naming.*; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF; import weblogic.common.T3ServicesDef; import weblogic.common.T3StartupDef; import java.util.Hashtable; /** * This startup class created and binds an instance of a * PersistenceBrokerFactoryIF into JNDI. */ public class OjbPbStartup implements T3StartupDef, OjbPbFactory { private String defaultPropsFile = org/apache/ojb/weblogic/OJB.properties; private T3ServicesDef services; public void setServices (T3ServicesDef services) { this.services = services; } public PersistenceBrokerFactoryIF getInstance() { return
addGreaterOrEqual
Hey can some one tell me what is wrong with the following c.addGreaterOrEqualThan(initial_limit,new Integer(score)); c.addLessOrEqualThan(final_limit,new Integer(score)); QueryByCriteria query = new QueryByCriteria(Quizscore.class, c); Quizscore q = (Quizscore)broker.getObjectByQuery(query); broker.commitTransaction(); return q; its returning me a null object although I know the score I am passing exists in valid range. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [jBoss deployment re-deployment!]: example ejb beans not deploying
Hi Phil, I got it re-deployed on jboss!! Thanks for your suggestion! It doesn't depend on the Class-Path attribute but it does depend on the jars used by OJB. Put all jars OJB depend on to the ojb.sar directory (commons-xxx.jar + antlrxxx.jar) then OJB could be re-deployed without any problems. I updated deployment docs in CVS have a look. regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: Phil Warrick [EMAIL PROTECTED] Cc: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 7:57 PM Subject: Re: [jBoss deployment]: example ejb beans not deploying BTW: A nice reference on deployment packaging can be found at: http://www.theserverside.com//resources/articles/J2EE-Deployment/article .html Phil Phil Warrick wrote: Hi Armin, The problem went away when I upgraded to jBoss-3.0.6. One that I noticed in build-xdoclet.xml (although it didn't end up being the cause of the problem) is that the MANIFEST.MF classpath syntax is supposed to be Class-Path: xxx.jar yyy.jar rather than classpath: xxx.jar yyy.jar To be more consistent wouldn't it be better to include all the jars that the beans are dependent on, like: Class-Path: db-ojb-1.0.rc2.jar db-ojb-1.0.rc2-junit.jar as well as the libs required (like commons-lang-1.0-mod.jar etc.) in the build-xdoclet.xml file. At the moment only the junit jar is listed. Thanks, Phil Armin Waibel wrote: Hi Phil, I tested CVS with jboss 3.0.4 + 3.0.6 using sapDB. I use the same directory structure: ojb.sar |---META-INF | | | MANIFEST.MF, jboss-service.xml db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb config files Did you use current build.xml/xdoclet-build.xml file, I made some minor changes (as far as I know;-)) regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:57 PM Subject: [jBoss deployment]: example ejb beans not deploying Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - 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: fix for MSSQL server and sequences
Hi Ryan, could you please send me your files directly (your attachment was 'eaten' by apache server). I will review your files and integrate them in the sequence-package (if possible) and sequence docs. regards, Armin - Original Message - From: Ryan Vanderwerf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 8:56 PM Subject: fix for MSSQL server and sequences I've come up with a fix for people who are not using identities in SQL server, but want oracle-style sequencing on multi-app server environments. I'm not sure what the procedure is to put this into the OJB code base, so I'll just post the files here. This is in response to problems using SequenceManagerHighLowImpl on SQL Server, because SQL server doesn't support read locking. The result in a multi-app server environment is quite disastrous - it will give out duplicated keys, which then in turn over-write newly inserted records with updates. This solution uses a stored procedure which can give out a new sequence and update the table in one call, so there are no read-locking issues (SQL server doesn't really support read locking, or select for update, etc). I've also made a new sequence generator class (I couldn't put everything I needed into the platform file, since I needed to get the max_key value before creating a new sequence.). This solution will give those seeking an oracle-style sequence generator a final answer (Identity columns really suck). Also is an updated platform file that builds the sql to call the stored procedure. I've tested pushing over 50,000 records through this code with no problems. I've tested this against v0.0.9, and currently it only supports a grab size of 1. Credit goes out to our dba Jean Macnutt for writing the stored procedure. Happy sequencing, Ryan Vanderwerf - 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: [jBoss deployment re-deployment!]: example ejb beans not deploying
Hi Armin, Great, I am also able to redeploy. As for the docs, The only things that I see now that might be non-obvious for someone trying the ejb beans for the first time are 1) How to deploy ojb test hsqldb database to jboss After creating the database with bin\build prepare-testdb Take the generated OJB.script file from .../target/test and rename the file to default.script. Replace the jboss default.script file in ...\jboss-3.x.y\server\default\db\hypersonic with this file. 2) How to run client org.apache.ojb.ejb.AllTests Numerous jars are required for the client. I modified build.bat to set this up properly and called it .\runEJBClient.bat @echo off REM Please let JAVA_HOME point to your JDK base directory if %JAVA_HOME% == set JAVA_HOME=C:\j2sdk1.4.1 set JAVA=%JAVA_HOME%\bin\java set JBOSS_HOME=D:\jboss-3.0.6 set cp= for %%i in (%JBOSS_HOME%\client\*.jar) do call bin\cp.bat %%i for %%i in (dist\*.jar) do call bin\cp.bat %%i for %%i in (lib\*.jar) do call bin\cp.bat %%i %JAVA% -classpath %CP% org.apache.ojb.ejb.AllTests Phil Armin Waibel wrote: Hi Phil, I got it re-deployed on jboss!! Thanks for your suggestion! It doesn't depend on the Class-Path attribute but it does depend on the jars used by OJB. Put all jars OJB depend on to the ojb.sar directory (commons-xxx.jar + antlrxxx.jar) then OJB could be re-deployed without any problems. I updated deployment docs in CVS have a look. regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: Phil Warrick [EMAIL PROTECTED] Cc: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 7:57 PM Subject: Re: [jBoss deployment]: example ejb beans not deploying BTW: A nice reference on deployment packaging can be found at: http://www.theserverside.com//resources/articles/J2EE-Deployment/article .html Phil Phil Warrick wrote: Hi Armin, The problem went away when I upgraded to jBoss-3.0.6. One that I noticed in build-xdoclet.xml (although it didn't end up being the cause of the problem) is that the MANIFEST.MF classpath syntax is supposed to be Class-Path: xxx.jar yyy.jar rather than classpath: xxx.jar yyy.jar To be more consistent wouldn't it be better to include all the jars that the beans are dependent on, like: Class-Path: db-ojb-1.0.rc2.jar db-ojb-1.0.rc2-junit.jar as well as the libs required (like commons-lang-1.0-mod.jar etc.) in the build-xdoclet.xml file. At the moment only the junit jar is listed. Thanks, Phil Armin Waibel wrote: Hi Phil, I tested CVS with jboss 3.0.4 + 3.0.6 using sapDB. I use the same directory structure: ojb.sar |---META-INF | | | MANIFEST.MF, jboss-service.xml db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb config files Did you use current build.xml/xdoclet-build.xml file, I made some minor changes (as far as I know;-)) regards, Armin - Original Message - From: Phil Warrick [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, March 18, 2003 3:57 PM Subject: [jBoss deployment]: example ejb beans not deploying Hi all, It looks like Armin has done a nice job of improving the out-of-the-box ejb deployment experience. But something about the new arrangement, where a sar directory containing db-ojb-xxx-beans.jar db-ojb-xxx.jar ojb configuration files jboss META-INF descriptor files causes the beans to not see the classes within db-ojb-xxx.jar. I get errors like NoClassDefFound for OJBRuntimeException, which is certainly located in db-ojb-xxx.jar. The OJB services do deploy fine if I leave out the beans jar. I noticed that the deployer is now a RAR which might influence dependencies. My environment is Win2K, jboss 3.0.4, ojb 1.0rc+ What is your environment Armin? I'm checking the jBoss archives and also watching for clues about the redeployment problem. Any ideas would be most appreciated. Phil - 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]