Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 38287 invoked from network); 3 May 2006 02:57:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 May 2006 02:57:27 -0000 Received: (qmail 51638 invoked by uid 500); 3 May 2006 02:57:26 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 51618 invoked by uid 500); 3 May 2006 02:57:25 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 51607 invoked by uid 99); 3 May 2006 02:57:25 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2006 19:57:25 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [202.58.71.77] (HELO ekalifid1.ekalife.co.id) (202.58.71.77) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 May 2006 19:57:23 -0700 Received: (qmail 8515 invoked from network); 3 May 2006 02:56:52 -0000 X-NetworkBox-HamSign: 0101;OUT;ekalifid1;27a272d6952302548b197ff9fd73c94e; Received: from unknown (HELO ekalife.co.id) (128.21.32.2) by 128.21.32.27 with SMTP; 3 May 2006 02:56:52 -0000 Received: from ekamailserver.ekalife2000.com [128.21.32.15] by ekalife.co.id [128.21.32.2] with SMTP (MDaemon.v3.5.8.R) for ; Wed, 03 May 2006 09:53:50 +0700 Subject: RE: iBatis enhancements (Annotations and/or Dynamic beanutils support) MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Wed, 3 May 2006 09:52:50 +0700 content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: iBatis enhancements (Annotations and/or Dynamic beanutils support) Thread-Index: AcZuWZiK+BgygxOvRpWrOPO8q5xN0wAAFA2AAAB/2zA= From: "Yusuf" To: X-MDRemoteIP: 128.21.32.15 X-Return-Path: Yusuf@ekalife.co.id X-MDaemon-Deliver-To: user-java@ibatis.apache.org X-Scanned-By-ekalifid1: Virus scan performed by network-box X-Scanned-By-ekalifid1: Scanner file id is ekalifid1-1146625012.629-8510-000 X-Scanned-By-ekalifid1: No known viruses found in message (received+scanned in 0.03/0.09 secs) X-Scanned-By-ekalifid1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N actually, i think it worked like that.. i've been using HashMaps for quite some time to pass parameters, just like Jeff said: HashMap hm =3D new HashMap(); hm.put(fieldName, value); service.insert(hm); one thing you have to notice though, i don't know if this is a bug, but if you put a java.util.Date in a HashMap,=20 then it'll only save the date value, not the time (example: the value "01/01/1981 19:23:12" will be saved as "01/01/1981 00:00:00) yusuf -----Original Message----- From: Brent Ryan [mailto:bryan@blackboard.com] Sent: Wednesday, May 03, 2006 9:39 AM To: user-java@ibatis.apache.org Subject: RE: iBatis enhancements (Annotations and/or Dynamic beanutils support) How would I do the sqlmap? Is there a way to match the fieldName with a column if I use the hashmap? How would this look in the sql map? =20 select EXTENDED_MERCHANT_SEQ.NEXTVAL as merchantId from DUAL=20 insert into EXTENDED_MERCHANTS (MERCHANT_ID, NAME, CONTACT, EMAIL, PHONE, COMMENTS, VENDOR_ID, VENDOR_SITE_ID, INVOICE_EMAIL, EXTERNAL_MERCHANT) values (#merchantId#, #merchantName#, #merchantContact#, #merchantEmail#, #merchantPhone#, #merchantComments#, #vendorId#, #vendorSiteId#, #invoiceEmail#, #externalMerchant#)=20 Will iBatis assume that the key of the hash matches the values()? I wasn't aware that this is how it worked... Would it assume that everything in the hash is in the same order as the columns? I don't think it works like this... Does it? =20 And to answer your other questions....yes, I basically parse the text file and cast the value to either BigDecimal or Date depending on another configuration in a properties file. =20 Brent =20 From: Jeff Butler [mailto:jeffgbutler@gmail.com]=20 Sent: Tuesday, May 02, 2006 7:30 PM To: user-java@ibatis.apache.org Subject: Re: iBatis enhancements (Annotations and/or Dynamic beanutils support) You didn't say how you were getting "value" (I'm assuming you must parse the text line and do type conversions somewhere else), but why not something as simple as this... =20 HashMap hm =3D new HashMap(); hm.put(fieldName, value); service.insert(hm); =20 Am I missing something that's really fundamental? =20 Jeff Butler =20 On 5/2/06, Brent Ryan wrote:=20 If I have a text file with fields name, email, phone and I want to load this into a table using iBatis... how would you do this?=20 =20 Example text file: brent, abc@something.com, 5555555555=20 =20 //This would normally be loaded from a properties file String fieldName =3D "name"; =20 DynaBean obj =3D new LazyDynaBean(); =20 PropertyUtils.set(obj, fieldName, value); =20 //insert my data using iBatis service.insert(obj); =20 Now, how can I do that with a hashmap? =09 Brent =09 =20 From: Jeff Butler [mailto:jeffgbutler@gmail.com ]=20 =09 Sent: Tuesday, May 02, 2006 7:10 PM =09 To: user-java@ibatis.apache.org=20 Subject: Re: iBatis enhancements (Annotations and/or Dynamic beanutils support) =09 Is there some reason that a HashMap won't work for you here? It works fine in iBATIS with exactly the syntax you've specified below. You're probably doing the same amount of work to load up the DynaBean that you would do to load a HashMap.=20 =20 Regarding annotations - As I thought more about it I remembered that we've just recently stopped supporting JDK 1.3! I think it will be a while before can sefely add any Java 5 specific features. =20 Jeff Butler =20 On 5/2/06, Brent Ryan wrote:=20 Well, my usecase for beanutils is that I didn't want to have to create POJO's at all. I wanted my application and iBatis to figure out dynamically the data that I'm putting into a database. In this particular application I have a bunch of configuration information in a properties file and one of the configurations is "fieldNames". These field names correspond directly to the fieldNames in my POJO's.=20 =20 If iBatis supported this then I would be able to specify something like this in my sqlmap: =20 =20 select EXTENDED_MERCHANT_SEQ.NEXTVAL as merchantId from DUAL insert into EXTENDED_MERCHANTS (MERCHANT_ID, NAME, CONTACT, EMAIL, PHONE, COMMENTS, VENDOR_ID, VENDOR_SITE_ID, INVOICE_EMAIL, EXTERNAL_MERCHANT) values (#merchantId#, #merchantName#, #merchantContact#, #merchantEmail#, #merchantPhone#, #merchantComments#, #vendorId#, #vendorSiteId#, #invoiceEmail#, #externalMerchant#)=20 =09 Basically, I'm lazy and I didn't want to have to create a POJO. It seems like I'm constantly having to enter the same field names over and over again... This would just be one place to eliminate that.=20 =20 For annotations... I wasn't really sure other then I've seen some cool uses with the hibernate annotations. Maybe replace some of the result map configurations, default values, etc.. with annotations. Other then that, I'm not sure of another use for this...=20 =20 Brent =09 From: Jeff Butler [mailto:jeffgbutler@gmail.com ]=20 Sent: Tuesday, May 02, 2006 6:15 PM To: user-java@ibatis.apache.org Subject: Re: iBatis enhancements (Annotations and/or Dynamic beanutils support) =09 =09 =09 Regarding beanutils - this has been discussed on the list several times. The general feeling is that we want to keep the iBATIS dependancies to a minimum, so I don't think we'll see direct support of DynaBeans. You certainly could use a HashMap as a result class in iBATIS, and then create LazyDynaMap instances from the returned HashMaps. This would give you DynaBean behavior and would work directly with iBATIS today. Is there something about that approach that doesn't work for you?=20 =20 Regarding annotations - could you be more specific about what you're looking for? =20 Jeff Butler =09 =20 On 5/2/06, Brent Ryan wrote:=20 Anyone know if Java 5 annotations or dynamic beanutils support will work in a future version of iBatis? =20 Brent =09 =09 This e-mail is intended only for the personal and confidential use of the recipient(s) named above.=20 It may include Blackboard confidential and proprietary information, and is not for redistribution.=20 =09 =09 =09 This e-mail is intended only for the personal and confidential use of the recipient(s) named above.=20 It may include Blackboard confidential and proprietary information, and is not for redistribution.=20 =09 This e-mail is intended only for the personal and confidential use of the recipient(s) named above.=20 It may include Blackboard confidential and proprietary information, and is not for redistribution.=20