RE: select key and insert with failure

2007-09-03 Thread Lott, Neil
Hi Larry,

Thanks for taking care of this.

Neil

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Larry Meadors
Sent: Monday, September 03, 2007 3:49 PM
To: user-java@ibatis.apache.org
Subject: Re: select key and insert with failure

I see his point, it's a pain to have it fail and then leave a mess to
clean up - no worries now, it'll be part of the next release. :-)

Larry


On 9/3/07, Nathan Maves <[EMAIL PROTECTED]> wrote:
> Well I am not sure why you would care but I would suggest that when
the
> insert fails, which should produce an exception, that you catch that
and
> then set the id field back to null.
>
> Nathan
>
>
>  On 9/3/07, Lott, Neil <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> >
> >
> > If I have a selectKey pre within an insert statement that I have
working:
> >
> >
> >
> > 
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.Integer"/>
> >
> >
> >
> >
> >
> > parameterMap="create-cast-param">
> >
> >   insert into OD_ACTOR
> >
> >   (
> >
> >  ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,
> >
> >  OD_ACTOR_ID
> >
> >   ) values (
> >
> >  ?, ?, ?,
> >
> >  ?
> >
> >   )
> >
> >
> >
> >   
> >
> >  select OD_ACTOR_ID_SEQ.NEXTVAL from dual
> >
> >   
> >
> >
> >
> >
> >
> > Let's say my insert fails, then the select key will still populate
the
> actorID in my castBean.  Is there a way for this value not to be
populated
> if the insert fails?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Neil This E-mail and any of its attachments may contain Time Warner
> > Cable proprietary information, which is privileged, confidential,
> > or subject to copyright belonging to Time Warner Cable. This E-mail
> > is intended solely for the use of the individual or entity to which
> >
> > it is addressed. If you are not the intended recipient of this
> > E-mail, you are hereby notified that any dissemination,
> > distribution, copying, or action taken in relation to the contents
> > of and attachments to this E-mail is strictly prohibited and may be
> >
> > unlawful. If you have received this E-mail in error, please notify
> > the sender immediately and permanently delete the original and any
> > copy of this E-mail and any printout.
> >
> >
>
>
This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.


Re: select key and insert with failure

2007-09-03 Thread Larry Meadors
I see his point, it's a pain to have it fail and then leave a mess to
clean up - no worries now, it'll be part of the next release. :-)

Larry


On 9/3/07, Nathan Maves <[EMAIL PROTECTED]> wrote:
> Well I am not sure why you would care but I would suggest that when the
> insert fails, which should produce an exception, that you catch that and
> then set the id field back to null.
>
> Nathan
>
>
>  On 9/3/07, Lott, Neil <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> >
> >
> > If I have a selectKey pre within an insert statement that I have working:
> >
> >
> >
> > 
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.String"/>
> >
> >javaType="java.lang.Integer"/>
> >
> >
> >
> >
> >
> > parameterMap="create-cast-param">
> >
> >   insert into OD_ACTOR
> >
> >   (
> >
> >  ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,
> >
> >  OD_ACTOR_ID
> >
> >   ) values (
> >
> >  ?, ?, ?,
> >
> >  ?
> >
> >   )
> >
> >
> >
> >   
> >
> >  select OD_ACTOR_ID_SEQ.NEXTVAL from dual
> >
> >   
> >
> >
> >
> >
> >
> > Let's say my insert fails, then the select key will still populate the
> actorID in my castBean.  Is there a way for this value not to be populated
> if the insert fails?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Neil This E-mail and any of its attachments may contain Time Warner
> > Cable proprietary information, which is privileged, confidential,
> > or subject to copyright belonging to Time Warner Cable. This E-mail
> > is intended solely for the use of the individual or entity to which
> >
> > it is addressed. If you are not the intended recipient of this
> > E-mail, you are hereby notified that any dissemination,
> > distribution, copying, or action taken in relation to the contents
> > of and attachments to this E-mail is strictly prohibited and may be
> >
> > unlawful. If you have received this E-mail in error, please notify
> > the sender immediately and permanently delete the original and any
> > copy of this E-mail and any printout.
> >
> >
>
>


Re: select key and insert with failure

2007-09-03 Thread Larry Meadors
This should be fixed in SVN now - if you want to try it, you can check
it out and build it.

Larry


On 9/3/07, Lott, Neil <[EMAIL PROTECTED]> wrote:
>
> If I have a selectKey pre within an insert statement that I have working:
>
>
>
> 
>
>javaType="java.lang.String"/>
>
>javaType="java.lang.String"/>
>
>javaType="java.lang.String"/>
>
>javaType="java.lang.Integer"/>
>
>
>
>
>
> parameterMap="create-cast-param">
>
>   insert into OD_ACTOR
>
>   (
>
>  ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,
>
>  OD_ACTOR_ID
>
>   ) values (
>
>  ?, ?, ?,
>
>  ?
>
>   )
>
>
>
>   
>
>  select OD_ACTOR_ID_SEQ.NEXTVAL from dual
>
>   
>
>
>
>
>
> Let's say my insert fails, then the select key will still populate the
> actorID in my castBean.  Is there a way for this value not to be populated
> if the insert fails?


Re: select key and insert with failure

2007-09-03 Thread Nathan Maves
Well I am not sure why you would care but I would suggest that when the
insert fails, which should produce an exception, that you catch that and
then set the id field back to null.

Nathan

On 9/3/07, Lott, Neil <[EMAIL PROTECTED]> wrote:
>
>
>
> Hello,
>
>
>
> If I have a selectKey pre within an insert statement that I have working:
>
>
>
> 
>
>   
>
>   
>
>   
>
>   
>
>
>
>
>
>
>
>   insert into OD_ACTOR
>
>   (
>
>  ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,
>
>  OD_ACTOR_ID
>
>   ) values (
>
>  ?, ?, ?,
>
>  ?
>
>   )
>
>
>
>   
>
>  select OD_ACTOR_ID_SEQ.NEXTVAL from dual
>
>   
>
>
>
>
>
> Let's say my insert fails, then the select key will still populate the
> actorID in my castBean.  Is there a way for this value not to be populated
> if the insert fails?
>
>
>
> Thanks,
>
>
>
> Neil
>
> This E-mail and any of its attachments may contain Time Warner
> Cable proprietary information, which is privileged, confidential,
> or subject to copyright belonging to Time Warner Cable. This E-mail
> is intended solely for the use of the individual or entity to which
> it is addressed. If you are not the intended recipient of this
> E-mail, you are hereby notified that any dissemination,
> distribution, copying, or action taken in relation to the contents
> of and attachments to this E-mail is strictly prohibited and may be
> unlawful. If you have received this E-mail in error, please notify
> the sender immediately and permanently delete the original and any
> copy of this E-mail and any printout.
>
>


select key and insert with failure

2007-09-03 Thread Lott, Neil
 

Hello,

 

If I have a selectKey pre within an insert statement that I have
working:

 



  

  

  

  

   

 

   

  insert into OD_ACTOR

  (

 ACTOR_FIRST_NAME, ACTOR_LAST_NAME, ACTOR_BIO,

 OD_ACTOR_ID

  ) values (

 ?, ?, ?,

 ?

  )

 

  

 select OD_ACTOR_ID_SEQ.NEXTVAL from dual

  

   

 

Let's say my insert fails, then the select key will still populate the
actorID in my castBean.  Is there a way for this value not to be
populated if the insert fails?

 

Thanks,

 

Neil

This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.


Re: JavaBean and Map parameters

2007-09-03 Thread Larry Meadors
Heh, I think I wrote that part. :-)

You can't reliably refer to an *anonymous* inner class by name (hence
the anonymous part - IIRC, they are assigned names by location
MyClass$1, MyClass$2, etc), so you can't safely put the name in your
mapped statement, so iBATIS doesn't do that load time checking
(because it doesn't know the parameter class name).

For load time checking to work, the parameter class name has to be
associated with the mapped statement (either as an explicit parameter
map, or a parameterClass attribute).

Larry


On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
>
> Hi Larry,
>
> Larry Meadors wrote:
> > I don't know about the performance - a hashmap is pretty fast for
> > retrieval. (FYI: the constructor you use there will cause slower
> > performance - the default would use more memory, but be faster - using
> > 3 or 4 as the parameter might be better, read the javadocs on that
> > one.)
> >
> Oh sure, I forgot about the .75 load factor. Thanks for telling me this!
> I agree in this case it's better not to use the parameter at all.
>
> > The parameter checking is an interesting idea - I'm just not sure that
> > it makes it much less error prone - in both cases, you need to type
> > (or paste) the names.
> >
> It's not my idea, actually. I found it in the section "JavaBean and Map
> parameters" of "iBatis in Action". It sais:
> "If you create a parameter map with a bean and attempt to refer to a
> property that does not exist, you will get an immediate failure when the
> parameter map is loaded." I tested it now with the anonymous parameter
> class I cited before and it doesn't seem to work as described:  the
> "There is no READABLE property named" exception is thrown only when the
> query is called, not when the map is loaded. I think I got something
> wrong again :)
>
> Regards
> Ilya
>
>
> > On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
> >
> >> Thanks, Larry!
> >>
> >> but could you tell me why? I thought using an anonymous class has an
> >> important advantage: it allows loading-time parameter check. Also I
> >> think it should be faster than using HashMap. Isn't it true?
> >>
> >> Ilya
> >>
> >> Larry Meadors wrote:
> >>
> >>> Well, they should both do the same thing...I'd use the map. :)
> >>>
> >>> Larry
> >>>
> >>>
> >>> On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
>  Hello all,
> 
>  what should I prefer, this:
> 
>  return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
>  Object() {
>  long getPersonId() { return personId; }
>  String getLang() { return lang; }
>  });
> 
>  or this:
> 
>  final Map params = new HashMap(2);
>  params.put("personId", personId);
>  params.put("lang", lang);
>  return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
>  params);
> 
>  Thanks in advance
>  Ilya
> 
> 
>
>
>
> FH JOANNEUM Gesellschaft mbH
> Rechtsform/Legal form: GmbH
> Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
> Firmenbuchnummer/Company registration: FN 125888 f
> DVR: 0813559
> UID-Nr.: ATU 42361001
>


RE: JavaBean and Map parameters

2007-09-03 Thread Niels Beekman
This only holds when the bean-class is explicitly specified, i.e. it must not 
be an anonymous class. If it's anonymous, iBATIS has no way to inspect the bean 
class, since it's unknown at load-time.

Niels

-Original Message-
From: Ilya Boyandin [mailto:[EMAIL PROTECTED] 
Sent: maandag 3 september 2007 18:43
To: user-java@ibatis.apache.org
Subject: Re: JavaBean and Map parameters


Hi Larry,

Larry Meadors wrote:
> I don't know about the performance - a hashmap is pretty fast for
> retrieval. (FYI: the constructor you use there will cause slower
> performance - the default would use more memory, but be faster - using
> 3 or 4 as the parameter might be better, read the javadocs on that
> one.)
>   
Oh sure, I forgot about the .75 load factor. Thanks for telling me this! 
I agree in this case it's better not to use the parameter at all.

> The parameter checking is an interesting idea - I'm just not sure that
> it makes it much less error prone - in both cases, you need to type
> (or paste) the names.
>   
It's not my idea, actually. I found it in the section "JavaBean and Map 
parameters" of "iBatis in Action". It sais:
"If you create a parameter map with a bean and attempt to refer to a 
property that does not exist, you will get an immediate failure when the 
parameter map is loaded." I tested it now with the anonymous parameter 
class I cited before and it doesn't seem to work as described:  the 
"There is no READABLE property named" exception is thrown only when the 
query is called, not when the map is loaded. I think I got something 
wrong again :)

Regards
Ilya


> On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
>   
>> Thanks, Larry!
>>
>> but could you tell me why? I thought using an anonymous class has an
>> important advantage: it allows loading-time parameter check. Also I
>> think it should be faster than using HashMap. Isn't it true?
>>
>> Ilya
>>
>> Larry Meadors wrote:
>> 
>>> Well, they should both do the same thing...I'd use the map. :)
>>>
>>> Larry
>>>
>>>
>>> On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
>>>
>>>   
 Hello all,

 what should I prefer, this:

 return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
 Object() {
 long getPersonId() { return personId; }
 String getLang() { return lang; }
 });

 or this:

 final Map params = new HashMap(2);
 params.put("personId", personId);
 params.put("lang", lang);
 return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
 params);

 Thanks in advance
 Ilya

 



FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001


Re: JavaBean and Map parameters

2007-09-03 Thread Ilya Boyandin


Hi Larry,

Larry Meadors wrote:

I don't know about the performance - a hashmap is pretty fast for
retrieval. (FYI: the constructor you use there will cause slower
performance - the default would use more memory, but be faster - using
3 or 4 as the parameter might be better, read the javadocs on that
one.)
  
Oh sure, I forgot about the .75 load factor. Thanks for telling me this! 
I agree in this case it's better not to use the parameter at all.



The parameter checking is an interesting idea - I'm just not sure that
it makes it much less error prone - in both cases, you need to type
(or paste) the names.
  
It's not my idea, actually. I found it in the section "JavaBean and Map 
parameters" of "iBatis in Action". It sais:
"If you create a parameter map with a bean and attempt to refer to a 
property that does not exist, you will get an immediate failure when the 
parameter map is loaded." I tested it now with the anonymous parameter 
class I cited before and it doesn't seem to work as described:  the 
"There is no READABLE property named" exception is thrown only when the 
query is called, not when the map is loaded. I think I got something 
wrong again :)


Regards
Ilya



On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
  

Thanks, Larry!

but could you tell me why? I thought using an anonymous class has an
important advantage: it allows loading-time parameter check. Also I
think it should be faster than using HashMap. Isn't it true?

Ilya

Larry Meadors wrote:


Well, they should both do the same thing...I'd use the map. :)

Larry


On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:

  

Hello all,

what should I prefer, this:

return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
Object() {
long getPersonId() { return personId; }
String getLang() { return lang; }
});

or this:

final Map params = new HashMap(2);
params.put("personId", personId);
params.put("lang", lang);
return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
params);

Thanks in advance
Ilya






FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001


Re: JavaBean and Map parameters

2007-09-03 Thread Jiming Liu
I dont know how iBatis set the properties of a bean. In case it uses
reflection, it surely will slower than hashmap. But if it uses the
bean.set...(...) directly, i believe it is faster than hashmap.

Jiming



On 9/3/07, Larry Meadors <[EMAIL PROTECTED]> wrote:
>
> I don't know about the performance - a hashmap is pretty fast for
> retrieval. (FYI: the constructor you use there will cause slower
> performance - the default would use more memory, but be faster - using
> 3 or 4 as the parameter might be better, read the javadocs on that
> one.)
>
> The parameter checking is an interesting idea - I'm just not sure that
> it makes it much less error prone - in both cases, you need to type
> (or paste) the names.
>
> Larry
>
>
> On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
> >
> > Thanks, Larry!
> >
> > but could you tell me why? I thought using an anonymous class has an
> > important advantage: it allows loading-time parameter check. Also I
> > think it should be faster than using HashMap. Isn't it true?
> >
> > Ilya
> >
> > Larry Meadors wrote:
> > > Well, they should both do the same thing...I'd use the map. :)
> > >
> > > Larry
> > >
> > >
> > > On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
> > >
> > >> Hello all,
> > >>
> > >> what should I prefer, this:
> > >>
> > >> return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
> new
> > >> Object() {
> > >> long getPersonId() { return personId; }
> > >> String getLang() { return lang; }
> > >> });
> > >>
> > >> or this:
> > >>
> > >> final Map params = new HashMap(2);
> > >> params.put("personId", personId);
> > >> params.put("lang", lang);
> > >> return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
> > >> params);
> > >>
> > >> Thanks in advance
> > >> Ilya
> > >>
> >
> >
> >
> > FH JOANNEUM Gesellschaft mbH
> > Rechtsform/Legal form: GmbH
> > Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
> > Firmenbuchnummer/Company registration: FN 125888 f
> > DVR: 0813559
> > UID-Nr.: ATU 42361001
> >
>


Re: JavaBean and Map parameters

2007-09-03 Thread Larry Meadors
I don't know about the performance - a hashmap is pretty fast for
retrieval. (FYI: the constructor you use there will cause slower
performance - the default would use more memory, but be faster - using
3 or 4 as the parameter might be better, read the javadocs on that
one.)

The parameter checking is an interesting idea - I'm just not sure that
it makes it much less error prone - in both cases, you need to type
(or paste) the names.

Larry


On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
>
> Thanks, Larry!
>
> but could you tell me why? I thought using an anonymous class has an
> important advantage: it allows loading-time parameter check. Also I
> think it should be faster than using HashMap. Isn't it true?
>
> Ilya
>
> Larry Meadors wrote:
> > Well, they should both do the same thing...I'd use the map. :)
> >
> > Larry
> >
> >
> > On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
> >
> >> Hello all,
> >>
> >> what should I prefer, this:
> >>
> >> return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
> >> Object() {
> >> long getPersonId() { return personId; }
> >> String getLang() { return lang; }
> >> });
> >>
> >> or this:
> >>
> >> final Map params = new HashMap(2);
> >> params.put("personId", personId);
> >> params.put("lang", lang);
> >> return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
> >> params);
> >>
> >> Thanks in advance
> >> Ilya
> >>
>
>
>
> FH JOANNEUM Gesellschaft mbH
> Rechtsform/Legal form: GmbH
> Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
> Firmenbuchnummer/Company registration: FN 125888 f
> DVR: 0813559
> UID-Nr.: ATU 42361001
>


Re: Not working with derby 10.3.1.4

2007-09-03 Thread Larry Meadors
Hm, OK..is the hostName property null? Some JDBC drivers gag on that,
and you have to provide a database type - like this:
#hostName:VARCHAR# - try that, and see if it makes it happy.

Larry


On 9/3/07, Zsolt Koppany <[EMAIL PROTECTED]> wrote:
> CREATE TABLE users(id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY
> PRIMARY KEY,name VARCHAR(50) NOT NULL,passwd CHAR(254),status
> VARCHAR(255),hostname VARCHAR(255),firstname VARCHAR(100),
> lastname VARCHAR(150),title VARCHAR(50),address VARCHAR(255),zip
> VARCHAR(15),city VARCHAR(80),state VARCHAR(50),
> source_of_interest VARCHAR(255),scc VARCHAR(50),team_size
> VARCHAR(10),division_size VARCHAR(10),company VARCHAR(255),
> country VARCHAR(255),email VARCHAR(255),email_client VARCHAR(255),
> phone VARCHAR(255),mobil VARCHAR(255),date_format VARCHAR(255),
> datetime_format VARCHAR(255),timezone VARCHAR(255),downloadlimit
> INTEGER DEFAULT -1 NOT NULL,workspace_id INTEGER,browser
> VARCHAR(255),skills VARCHAR(4000),  wiki_homepage_id INTEGER,
> registrydate TIMESTAMP,lastlogin TIMESTAMP,indexed CHAR(1) DEFAULT
> '0' NOT NULL,unused0 VARCHAR(255),unused1 VARCHAR(255),unused2
> VARCHAR(255),UNIQUE(name)) ;
>
>
>
> 
>  "http://ibatis.apache.org/dtd/sql-map-2.dtd";>
>
> 
>
> 
>  serialize="true">
> 
> 
> 
>
> 
> 
>
>  type="com.intland.codebeamer.persistence.dto.UserDto"/>
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
> INSERT INTO
> users (${PRE_ID_COMMENT}id,${POST_ID_COMMENT} name, passwd,
> status, hostname, firstname, lastname, title, address, zip, city, state,
> source_of_interest,
> scc, team_size,division_size, company,
> country, email, email_client, phone, mobil,
> date_format, datetime_format, timezone,
> downloadlimit, browser, skills, registrydate, lastlogin,
> unused0, unused1, unused2, indexed)
> VALUES  (${PRE_ID_COMMENT}#id#, ${POST_ID_COMMENT} #name#,
> ${PASSWORD_ENCRYPT}(#password#), #status#, #hostName#, #firstName#,
> #lastName#, #title#,
> #address#, #zip#, #city#, #state#,
> #sourceOfInterest#, #scc#, #teamSize#,
> #divisionSize#, #company#, #country#, #email#, #emailClient#,
> #phone#, #mobile#, #dateFormatPattern#,
> #dateTimeFormatPattern#, #timeZonePattern#,
> #downloadLimit#, #browser#, #skills#,
> #registryDate#, #lastLogin#, #unused0#, #unused1#, #eauthid#, #indexed#)
>  type="${SELECTKEY_TYPE}" >
>
> ${SELECTKEY_BEFORE_TABLE_NAME_SQL_PART}users${SELECTKEY_AFTER_TABLE_NAME_SQL
> _PART}
> 
> 
>
> 
> UPDATE users SET
> 
>
> passwd=${PASSWORD_ENCRYPT}(#password#),unused1=#unused1#,
> 
> firstname=#firstName#, lastname=#lastName#, title=#title#,
> address=#address#,
> zip=#zip#, city=#city#, state=#state#, company=#company#,
> country=#country#,
> email=#email#, phone=#phone#, mobil=#mobile#,
> date_format=#dateFormatPattern#,
> datetime_format=#dateTimeFormatPattern#, timezone=#timeZonePattern#,
> wiki_homepage_id=#wikiHomepageId#,
>
> 
> name=#name#,
> 
>
> 
> email_client=#emailClient#,
> 
>
> 
> source_of_interest=#sourceOfInterest#,
> 
>
> 
> scc=#scc#,
> 
>
> 
> team_size=#teamSize#,
> 
>
> 
> division_size=#divisionSize#,
> 
>
> 
> browser=#browser#,
> 
>
> 
> skills=#skills#,
> 
>
> 
> status=#status#,
> 
>
> 
> downloadlimit=#downloadLimit#,
> 
>
> 
> unused0=#unused0#,
> 
>
> 
> unused2=#eauthid#,
> 
>
> 
> hostname=#hostName#,
> 
>
> 
> lastlogin=#lastLogin#,
> 
>
> 

RE: Using discriminator with an interface

2007-09-03 Thread MCCORMICK, Paul

If the sub classes have a common setter method then its possible the use the 
that setter as the required single result in the result map.  As you interface 
will not have setters you'll have to use any one of the sub classes 
(BlackSomething or WhiteSomething)  as the "class" attribute in the main result 
map.   The calling java code can do the cast to Isomething interface.

E,g.









Paul



-Original Message-
From: Ilya Boyandin [mailto:[EMAIL PROTECTED]
Sent: Monday, 3 September 2007 4:39 PM
To: user-java@ibatis.apache.org
Subject: Using discriminator with an interface


Hello all,

is that possible to use discriminator with an interface without setters?

I have something like this in my mappings:









...



...



...


And I always get this RuntimeException: "resultMap Something.somethingResult 
must have at least one result mapping". But somethingResult can't have any 
mappings because ISomething is an interface without any setters.

Am I doing something wrong or is there any other way to accomplish this?

Thanks in advance
Ilya




FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz 
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001

"DISCLAIMER: This email, including any attachments, is intended only for use by 
the addressee(s) and may contain confidential and/or personal information and 
may also be the subject of legal privilege. If you are not the intended 
recipient, you must not disclose or use the information contained in it. In 
this case, please let me know by return email, delete the message permanently 
from your system and destroy any copies.

Before you take any action based upon advice and/or information contained in 
this email you should carefully consider the advice and information and 
consider obtaining relevant independent advice.


Using discriminator with an interface

2007-09-03 Thread Ilya Boyandin


Hello all,

is that possible to use discriminator with an interface without setters?

I have something like this in my mappings:


   
   
   
   



   ...



   ...



   ...


And I always get this RuntimeException: "resultMap 
Something.somethingResult must have at least one result mapping". But 
somethingResult can't have any mappings because ISomething is an 
interface without any setters.


Am I doing something wrong or is there any other way to accomplish this?

Thanks in advance
Ilya




FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001


Re: JavaBean and Map parameters

2007-09-03 Thread Ilya Boyandin


Thanks, Larry!

but could you tell me why? I thought using an anonymous class has an 
important advantage: it allows loading-time parameter check. Also I 
think it should be faster than using HashMap. Isn't it true?


Ilya

Larry Meadors wrote:

Well, they should both do the same thing...I'd use the map. :)

Larry


On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
  

Hello all,

what should I prefer, this:

return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
Object() {
long getPersonId() { return personId; }
String getLang() { return lang; }
});

or this:

final Map params = new HashMap(2);
params.put("personId", personId);
params.put("lang", lang);
return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
params);

Thanks in advance
Ilya





FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001


RE: Not working with derby 10.3.1.4

2007-09-03 Thread Zsolt Koppany
CREATE TABLE users(id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY
PRIMARY KEY,name VARCHAR(50) NOT NULL,passwd CHAR(254),status
VARCHAR(255),hostname VARCHAR(255),firstname VARCHAR(100),
lastname VARCHAR(150),title VARCHAR(50),address VARCHAR(255),zip
VARCHAR(15),city VARCHAR(80),state VARCHAR(50),
source_of_interest VARCHAR(255),scc VARCHAR(50),team_size
VARCHAR(10),division_size VARCHAR(10),company VARCHAR(255),
country VARCHAR(255),email VARCHAR(255),email_client VARCHAR(255),
phone VARCHAR(255),mobil VARCHAR(255),date_format VARCHAR(255),
datetime_format VARCHAR(255),timezone VARCHAR(255),downloadlimit
INTEGER DEFAULT -1 NOT NULL,workspace_id INTEGER,browser
VARCHAR(255),skills VARCHAR(4000),  wiki_homepage_id INTEGER,
registrydate TIMESTAMP,lastlogin TIMESTAMP,indexed CHAR(1) DEFAULT
'0' NOT NULL,unused0 VARCHAR(255),unused1 VARCHAR(255),unused2
VARCHAR(255),UNIQUE(name)) ;




http://ibatis.apache.org/dtd/sql-map-2.dtd";>




















































INSERT INTO
users (${PRE_ID_COMMENT}id,${POST_ID_COMMENT} name, passwd,
status, hostname, firstname, lastname, title, address, zip, city, state,
source_of_interest,
scc, team_size,division_size, company,
country, email, email_client, phone, mobil,
date_format, datetime_format, timezone,
downloadlimit, browser, skills, registrydate, lastlogin,
unused0, unused1, unused2, indexed)
VALUES  (${PRE_ID_COMMENT}#id#, ${POST_ID_COMMENT} #name#,
${PASSWORD_ENCRYPT}(#password#), #status#, #hostName#, #firstName#,
#lastName#, #title#,
#address#, #zip#, #city#, #state#,
#sourceOfInterest#, #scc#, #teamSize#,
#divisionSize#, #company#, #country#, #email#, #emailClient#,
#phone#, #mobile#, #dateFormatPattern#,
#dateTimeFormatPattern#, #timeZonePattern#,
#downloadLimit#, #browser#, #skills#,
#registryDate#, #lastLogin#, #unused0#, #unused1#, #eauthid#, #indexed#)


${SELECTKEY_BEFORE_TABLE_NAME_SQL_PART}users${SELECTKEY_AFTER_TABLE_NAME_SQL
_PART}




UPDATE users SET


passwd=${PASSWORD_ENCRYPT}(#password#),unused1=#unused1#,

firstname=#firstName#, lastname=#lastName#, title=#title#,
address=#address#,
zip=#zip#, city=#city#, state=#state#, company=#company#,
country=#country#,
email=#email#, phone=#phone#, mobil=#mobile#,
date_format=#dateFormatPattern#,
datetime_format=#dateTimeFormatPattern#, timezone=#timeZonePattern#,
wiki_homepage_id=#wikiHomepageId#,


name=#name#,



email_client=#emailClient#,



source_of_interest=#sourceOfInterest#,



scc=#scc#,



team_size=#teamSize#,



division_size=#divisionSize#,



browser=#browser#,



skills=#skills#,



status=#status#,



downloadlimit=#downloadLimit#,



unused0=#unused0#,



unused2=#eauthid#,



hostname=#hostName#,



lastlogin=#lastLogin#,


indexed='0'
WHERE
id = #id#



UPDATE users SET lastlogin=#lastLogin#

hostname=#hostName#

WHERE id=#id#



DELETE FROM users WHERE $userIdInClause$



UPDATE users SET indexed='1' WHERE id=#value:INTEGER#



UPDATE users SET indexed='0' WHERE id=#value:INTEGER#



SELECT * FROM users



SELECT * FROM users