New to OJB
Return Receipt Your New to OJB documen t: was Вадим Терещенко/MSCO receive d by: at: 11.09.2003 08:53:50 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
New to OJB
Hi, I am new to OJB. I tried to look for docs on OJB at Jakarta but got nothing like a tutorial. Could anyone point me the some good beginners reading material. Or if possible kindly provide some sample source code? Sanjeet
Can't find xdoclet ojb module
Hello: I can't find the OJB module for XDoclet. Does it still exist? Where should I look? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xdoclet: How to use base-class properties with different colu mn n ames in children?
Ok, well I figured out that the version of Xdoclet-ojb that comes compiled with RC4 does not have this feature in it. I downloaded the most recent jar from CVS, and now it works, sort of. If it put my @ojb.field description in the class comment, it will now had the field-description, but now it always sets the access="anonymous", even if I specify an access="readwrite" for that field. Ways around this? -Original Message- From: Clute, Andrew [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 3:45 PM To: '[EMAIL PROTECTED]' Subject: Xdoclet: How to use base-class properties with different column n ames in children? So, let's say I have a base class 'BusinessObject' with a property called 'guid' So, I have two classes, both extend BusinessObject, named 'dog' and 'cat'. My database (which already exist), has a field in the tbl_dog table called "dog_guid", and the tbl_cat has "cat_guid". Before using Xdoclet to get my repository_user.xml, I would define the mapping for both dog and cat's guid, cooresponding the appropriate column name for that table, and the name of the field in the base class. I can't seem to find the same way to do it in Xdoclet-ojb -- It seems I have to have a property named "guid" in each of my child classes to attach an xdoclet tag to it. I have tried this: /** * @ojb.class table="tbl_cat" *include-inherited="true" * @ojb.field name="guid" *column="cat_guid" *jdbc-type="VARCHAR" */ Public class Cat extends BusinessObject But, it doesn't create the reference in the xml file. However, if I put a property called guid in the dog and cat classes, and the tag that, it works -- but that stinks because I am killing OO. Thoughts? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Xdoclet: How to use base-class properties with different column n ames in children?
So, let's say I have a base class 'BusinessObject' with a property called 'guid' So, I have two classes, both extend BusinessObject, named 'dog' and 'cat'. My database (which already exist), has a field in the tbl_dog table called "dog_guid", and the tbl_cat has "cat_guid". Before using Xdoclet to get my repository_user.xml, I would define the mapping for both dog and cat's guid, cooresponding the appropriate column name for that table, and the name of the field in the base class. I can't seem to find the same way to do it in Xdoclet-ojb -- It seems I have to have a property named "guid" in each of my child classes to attach an xdoclet tag to it. I have tried this: /** * @ojb.class table="tbl_cat" *include-inherited="true" * @ojb.field name="guid" *column="cat_guid" *jdbc-type="VARCHAR" */ Public class Cat extends BusinessObject But, it doesn't create the reference in the xml file. However, if I put a property called guid in the dog and cat classes, and the tag that, it works -- but that stinks because I am killing OO. Thoughts?
Re: Criteria in and equals with references
Works for me. Thank you. Mike Jakob Braeuchi wrote: hi mike, you can not use a whole object in a criteria, you'll have to use a single attribute (ie. b.name). hth jakob Michael Becke wrote: Hello, I am wondering what is the best way to handle Criteria.addEqualTo() and Criteria.addIn() when the field contains an object referenced from another table. For example. I want to be able to query A objects using something like criteria.addEqualsTo("b", ). When executing a query with this criteria OJB tries to bind the object B to the query instead of the B's ID. This causes an SQL exception. Should I just be using B's ID in the criteria or is there a way to make this work. Thank you, Mike - 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: Join tables that has fields with same name
hi istvan, this looks like a problem in your mapping. if ojb finds descriptors for the fields it prefixes them with a table alias (a.name). if no field is found the name from the criteria is used. hth jakob Viczián István wrote: Hi, I would like to join two table, and they are in 1:n relation, and they have a field with same name. If I add a criteria to this, I get an exception. This exception says, that the field is _ambiguous_. I've logged the SQL query with P6Spy, and it is true, the name of the field appears in the select statement without qualification, so the name of the field is really ambiguous. I've tried qualify with the table name, but it is not good, it should be qualified with the alias. Concretely symbolically: table A (a_id, samename); table B (b_id, a_id, samename, prop); A:B = 1:N Criteria c1; c.addEquals("samename", "blahblah"); // criteria for the Criteria c1; c.addEquals("b.prop", 1); // join Query for table A, request for A objects So the exception says, that the samename is ambiguous. The generated sql is something like this: select a_id, samename from A a0 INNER JOIN B a1 WHERE samename = 'blahblah' and a0.a_id = a1.b_id and a1.prop = 1; So the samename field appears without alias qualification. How should I correct my code without renaming columns to individual name? Thank you, Istvan --- Viczián István [Viczi] ([EMAIL PROTECTED]) Honlap: http://dragon.unideb.hu/~vicziani Mobil#: +36(30)3656804 ICQ#: 15803584 - 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: ReportQueryByCriteria and Extents problem
hi, imo both features are a problem on some databases: afaik subselects do not yet work in mysql and union is not supported in hsqldb. jakob Edson Carlos Ericksson Richter wrote: I think UNION is not a problem, but using a SELECT in a FROM clause could be. In any way, I've changed my code to expect more than one value when issuing max() in areas I have extents. Thanks, Edson Richter - Original Message - From: Charles Anthony To: 'OJB Users List' Sent: Tuesday, September 09, 2003 12:51 PM Subject: RE: ReportQueryByCriteria and Extents problem Hi Edson, [snip] > When I execute this command, I'm expecting that OJB will issue > >select max(nu_ordem) from > (select nu_ordem from tb_compttpessoa_taxa > union >select nu_ordem from tb_compttpessoa_percent > union >select nu_ordem from tb_compttpessoa_script ) > >that works fine in SapDB. But OJB is issuing three queries... > > It's a bug, or a expected feature? Currently it's an expected feature; I don't think that UNION is an ANSI standard SQL feature, and I'm not sure that all database platforms support it. Having said that, I've just done quick google for : select union DB2 select union SQL Server select union ORACLE select union MYSQL select union HSQLDB All of which return pages that look like Reference pages i.e. it appears all the main databases that OJB tries to support implement UNION. Maybe OJB should try and implement this somewhere... But OJB issuing three queries should not currently be considered a bug. Cheers, Charles. This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.515 / Virus Database: 313 - Release Date: 1/9/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Criteria in and equals with references
hi mike, you can not use a whole object in a criteria, you'll have to use a single attribute (ie. b.name). hth jakob Michael Becke wrote: Hello, I am wondering what is the best way to handle Criteria.addEqualTo() and Criteria.addIn() when the field contains an object referenced from another table. For example. I want to be able to query A objects using something like criteria.addEqualsTo("b", ). When executing a query with this criteria OJB tries to bind the object B to the query instead of the B's ID. This causes an SQL exception. Should I just be using B's ID in the criteria or is there a way to make this work. Thank you, Mike - 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: code for start/stop index to work for reportquery
Hi, your code attachement did not come through. Can you email me the classes on my personal account and I'll integrate them. -Original Message- From: Chiah Tong Kiat [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2003 11:15 PM To: OJB Users List Subject: code for start/stop index to work for reportquery Hi I've made some changes in PersistenceBorkerImpl.java to implement start/stop index in the getReportQueryIteratorByQuery method. I'm not too sure if this is inline with your convention. Pls review them Thanks Tong kiat
RE: proxy question
Hi, I don't actually use DynamicProxies (I do use them elsewhere, just not in in OJB), so I can't be much more help - but... The whole point of proxies is that you *shouldn't* get to the real class. You should always talk to the proxy, and the proxy talks to the real object. If you nead to expose functionality, you should put it on the interface... OJB doesn't do anything particularly wild or crazy with Proxies, so any documentation on them should give you some idea : http://java.sun.com/j2se/1.3/docs/guide/reflection/proxy.html If you absolutely *must* get at the object, I think you can do it via ProxyHelper org.apache.ojb.broker.util.ProxyHelper - it has two relevant methods getRealObject and getRealObjectIfMaterialized. I reiterate, though, it's not a good idea. Cheers, Charles. >-Original Message- >From: Joerg Lensing [mailto:[EMAIL PROTECTED] >Sent: 10 September 2003 17:13 >To: OJB Users List >Subject: Re: proxy question > > >Joerg Lensing wrote: > >> hi charles, >> ok, but how can I know do i get the real class? (instanceof doesn't >> work.. don't know why9 >> >> e.g. if (pPartnerPO instanceof PersonIF) --> returns >"true", but >> should be false!! > >sorry: should be > if (partnerIF instanceof PersonIF) { > >joerg > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: proxy question
Joerg Lensing wrote: hi charles, ok, but how can I know do i get the real class? (instanceof doesn't work.. don't know why9 e.g. if (pPartnerPO instanceof PersonIF) --> returns "true", but should be false!! sorry: should be if (partnerIF instanceof PersonIF) { joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: proxy question
hi charles, ok, but how can I know do i get the real class? (instanceof doesn't work.. don't know why9 e.g. if (pPartnerPO instanceof PersonIF) --> returns "true", but should be false!! joerg Charles Anthony wrote: In a word, Yes. Cheers, Charles. -Original Message- From: Joerg Lensing [mailto:[EMAIL PROTECTED] Sent: 10 September 2003 11:15 To: OJB Users List Subject: proxy question Hi all, do I have to reference all persistent (and mapped) objects by their interface if i want to use proxies? thanxs joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - 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: proxy question
In a word, Yes. Cheers, Charles. >-Original Message- >From: Joerg Lensing [mailto:[EMAIL PROTECTED] >Sent: 10 September 2003 11:15 >To: OJB Users List >Subject: proxy question > > >Hi all, >do I have to reference all persistent (and mapped) objects by their >interface if >i want to use proxies? > > thanxs joerg > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Criteria in and equals with references
Hello, I am wondering what is the best way to handle Criteria.addEqualTo() and Criteria.addIn() when the field contains an object referenced from another table. For example. I want to be able to query A objects using something like criteria.addEqualsTo("b", ). When executing a query with this criteria OJB tries to bind the object B to the query instead of the B's ID. This causes an SQL exception. Should I just be using B's ID in the criteria or is there a way to make this work. Thank you, Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
proxy question
Hi all, do I have to reference all persistent (and mapped) objects by their interface if i want to use proxies? thanxs joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Repost : NullPointerException in hashCode
Ok, I removed the hashCode too and OJB works well. But my hashCode was based on my object's pk. Now I have some problems putting my objects in a HashMap. So what can I do now ? Is this a bug that will be corrected or is it a known problem that will remain unchanged in the future ? Seb Christian Pesch wrote: Sebastien Cesbron wrote: Am I the only one that have this problem ? No :-) Can anybody tell me what I can do in this situation ? I removed hashCode() and waited for a wise suggestion, what to do :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Proxy question
hi all, when using dynamic proxies, do i allways have to use the the interface to access the objects? What do I have to change in the code to switch from "real" classes to proxies? joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use DUAL
I realized. The getBroker then getConnection is the way. Thanks for tips from everyone. Edson Richter - Original Message - From: Charles Anthony To: 'OJB Users List' Sent: Wednesday, September 10, 2003 3:35 AM Subject: RE: How to use DUAL Hi Edson, You say you're working "client-server" with OJB. Assuming that you do all the "persisting" on the server side (i.e. OJB only used on the server), you could use a PBListener for BeforeUpdate/Insert events, and set the datetime then (using a java.sql.Date). If you really just want to execute an arbitrary SQL statement (select TIMESTAMP from DUAL) , that doesn't map to a java class, then the simple answer is No, there is no better way to do it. Essentially : get a broker, get the brokers connection, create and execute the statement, close everything. Cheers, Charles. >-Original Message- >From: Edson Carlos Ericksson Richter >[mailto:[EMAIL PROTECTED] >Sent: 09 September 2003 20:33 >To: OJB Users List >Subject: Re: How to use DUAL > > >About secure messages, you are right. Excuses to mail list users. > >About using new Date(), this works fine if my app is j2ee based (like >JSP, web services and so on), but my app is Swing (by now >client-server) >based, and I need to guarantee that workstation (if I use new Date()) >has date/time correctly set... That isn't what I want. > >A malicious user could change date/time on workstation between process. >I must warranty that I will be using the server date/time so I can be >confident about it. > >Any other tips? > >I've implemented a call to a procedure, obtaining a connection from a >PersistenceBroker... But could be a more "expert" way to do it. > >Thanks for any tips, > >Edson Richter > > > >Em Seg, 2003-09-08 às 12:58, Roland Carlsson escreveu: >> Hi Edson! >> >> The simplest way to do this is to set the date in your >value-object. Eg setMyDate(new Date()); and then store the >object. Since most databases I tested support higher >time-resolutions than whole seconds or in your case (guessing >oracle) 1/10 of a second if I remember correctly it should be >good enough. >> >> Regards >> Roland Carlsson >> >> PS: Please don't send secure messages to a mailinglist. If >you need them to be secure add a hash in the end of the >message so it can be verified to be not alterd. >> >> - Original Message - >> From: Edson Carlos Ericksson Richter >> To: 'OJB Users List' >> Sent: Monday, September 08, 2003 3:56 PM >> Subject: How to use DUAL >> >> >> Hi! >> I want to execute a query in OJB to obtain database server >DATE. The query is >> >> select TIMESTAMP from DUAL >> >> How can I accomplish this using OJB? Should I use Procedures? >> >> >> >> Thanks, >> >> Edson Richter >> >> >> >> --- >> Outgoing mail is certified Virus Free. >> Checked by AVG anti-virus system (http://www.grisoft.com). >> Version: 6.0.515 / Virus Database: 313 - Release Date: 1/9/2003 > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.516 / Virus Database: 313 - Release Date: 1/9/2003
Re: Transactions with PB-API
Hi Lasse! You get several instances of PersistenseBroker. Each broker handles on transaction at a time. the broker have tre methods to handles transactions.. beginTransaction(); broker.commitTransaction(); broker.abortTransaction(); Regards Roland Carlsson - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 10, 2003 12:53 PM Subject: Transactions with PB-API > Hello everybody, > > how can I use several (concurrent) transactions using the PB-API. > With the ODMG-API I do something like > > Transaction tx = odmg.newTransaction(); > tx.begin(); > ... > > Lasse > > > > - > 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: code for start/stop index to work for reportquery
Hey Tong Kiat, Good to see you on this mailing list. Remember me? How are things at Silicomp? How long have you been part of OJB? Cheers Sanjeet Joshi - Original Message - From: Chiah Tong Kiat To: OJB Users List Sent: Wednesday, September 10, 2003 2:14 PM Subject: code for start/stop index to work for reportquery Hi I've made some changes in PersistenceBorkerImpl.java to implement start/stop index in the getReportQueryIteratorByQuery method. I'm not too sure if this is inline with your convention. Pls review them Thanks Tong kiat -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Transactions with PB-API
Hello everybody, how can I use several (concurrent) transactions using the PB-API. With the ODMG-API I do something like Transaction tx = odmg.newTransaction(); tx.begin(); ... Lasse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]