Re: Inserting Default values if object member is null

2005-11-14 Thread Michael Campbell
On 11/14/05, Larry Meadors <[EMAIL PROTECTED]> wrote: > Uhm, use a database default? Maybe. Don't all databases error on setting a non-nullable, defaulted column to null? (as opposed to not setting it at all).

Holding on to a connection, giving us Broken pipe error....

2005-11-14 Thread Thomas Bast
We use MySQL with both SQLMap and DAO. We are  configured to use Apache's DBCP data source. All transactions are automatic except for 2 where we needed to explicitly startTransaction()/commitTransaction/endTransaction(). The endTransaction() is always in a finally block, and we verified we are

RE: Too many methods on a service object

2005-11-14 Thread Shannon, Bryan
Just throwing in something I've seen before... A former co-worker of mine made a pretty elaborate solution to the problem of loading object graphs of arbitrary depth... (A contact that has an address, that has a city, that has a ...) She created metadata that were essentially constants shared bet

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
Yep, this is the way we initially had done it but my afilliate does not prefer it that way. However this is solved. Closed. Thanks, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 3:06 PM To: user-java@ibatis.apache.org Subject: Re:

Re: Inserting Default values if object member is null

2005-11-14 Thread Nathan Maves
Well the best bet now would be to initialize the java bean with a default value, i.e. -1. On Nov 14, 2005, at 12:56 PM, Jason Hall wrote: Okay, Just wanted to know, an afilliate of mine wanted to know. Thanks, JH. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTE

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
Okay, Just wanted to know, an afilliate of mine wanted to know. Thanks, JH. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Meadors Sent: Monday, November 14, 2005 2:53 PM To: user-java@ibatis.apache.org Subject: Re: Inserting Default values if o

Re: Inserting Default values if object member is null

2005-11-14 Thread Larry Meadors
On 11/14/05, Jason Hall <[EMAIL PROTECTED]> wrote: > > maybe ibatis should support this. I disagree. IMO this is something that should live inthe service/ business logic layer (if it is an application rule), or in the database (if it is an enterprise rule). Putting it in iBATIS (an itegration po

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
maybe ibatis should support this. From: Niels Beekman [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 2:34 PMTo: user-java@ibatis.apache.orgSubject: RE: Inserting Default values if object member is null You are right, you can’t, because there is no need, since the database supp

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
I've tried doing it inline and i still get the database error, cannot insert null value. I'm trying to insert -1 and not a  null value because the database column is set to not null. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 2:29 PMTo: user-java@iba

RE: Inserting Default values if object member is null

2005-11-14 Thread Niels Beekman
You are right, you can’t, because there is no need, since the database supports this natively.   Niels   From: Jason Hall [mailto:[EMAIL PROTECTED] Sent: maandag 14 november 2005 20:33 To: user-java@ibatis.apache.org Subject: RE: Inserting Default values if object member is nul

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
I don't want to insert null in the database, i want to insert -1 because the database column is set to not null. Maybe Ibatis does not support this. From: Niels Beekman [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 2:28 PMTo: user-java@ibatis.apache.orgSubject: RE: Inserting Def

RE: Inserting Default values if object member is null

2005-11-14 Thread Niels Beekman
You should use the DTD (http://ibatis.apache.org/dtd/sql-map-2.dtd). The property is actually nullValue, in your example:   When iBATIS finds -999 in the Dummy.id-property it will insert null into the database, when null is found in the database, iBATIS will put -999 in the Dummy.id-prope

Re: Inserting Default values if object member is null

2005-11-14 Thread Nathan Maves
BTW you could also do it inlineinsert into A (col1,col2) values (#col1:NUMERIC:-1#, #col2:VARCHAR:NO_ENTRY#This can be found on page 20 of the developers guideOn Nov 14, 2005, at 12:09 PM, Jason Hall wrote: Yah, but the db column is set to not null, so you would get a database error. I've tried th

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
I tried using null property and i get and sqlmapconfig parsing error - "null" not a valid property.             From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 2:24 PMTo: user-java@ibatis.apache.orgSubject: Re: Inserting Default values if object member

Re: Inserting Default values if object member is null

2005-11-14 Thread Nathan Maves
Whoops wrong attribute.You need to use null="" and not nullValue.This should substitute the given value for any property that is null.NathanOn Nov 14, 2005, at 12:09 PM, Jason Hall wrote: Yah, but the db column is set to not null, so you would get a database error. I've tried that anyhow, and

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
Yah, but the db column is set to not null, so you would get a database error. I've tried that anyhow, and got that not null error.  I believe the nullValue is used for a replacement to insert a null value not to define a default in the event the object property is null.   thx:)   From: [EMA

RE: Dynamic statement

2005-11-14 Thread Niels Beekman
You should use removeFirstPrepend="true" on the dynamic-tag, this causes iBATIS to skip the first prepend encountered. Hope this helps, Niels From: John Chien [mailto:[EMAIL PROTECTED] Sent: maandag 14 november 2005 18:30 To: user-java@ibatis.apache.org

Re: Inserting Default values if object member is null

2005-11-14 Thread Nathan Maves
You can specify your insert sqlmap to use a ParameterMap and set the nullValue property on the specific column.NathanOn Nov 14, 2005, at 11:16 AM, Jason Hall wrote: Hi,   I just want to know if an object member is set to null and the database column is configured as not null, is there a way in th

Re: Inserting Default values if object member is null

2005-11-14 Thread Larry Meadors
No, and as a rule, we try to avoid coding to "maybe requirements" - if you don't *need* it, don't write it. :-D Larry On 11/14/05, Jason Hall <[EMAIL PROTECTED]> wrote: > I know I can use a database default or initialize the java property but > I just > Wanted to know if it is also possible in

RE: Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
I know I can use a database default or initialize the java property but I just Wanted to know if it is also possible in the sqlmapconfig.xml file. They may be some requirements not to do it in java or the database itself. Is there a way? -Original Message- From: [EMAIL PROTECTED] [mailt

Re: Inserting Default values if object member is null

2005-11-14 Thread Larry Meadors
Uhm, use a database default? Larry On 11/14/05, Jason Hall <[EMAIL PROTECTED]> wrote: > > Hi, > > I just want to know if an object member is set to null and the database > column is configured as not null, > is there a way in the sqlmapconfig.xml to set a default value say -1 in a > parameter ma

Inserting Default values if object member is null

2005-11-14 Thread Jason Hall
Hi,   I just want to know if an object member is set to null and the database column is configured as not null, is there a way in the sqlmapconfig.xml to set a default value say -1 in a parameter map. I've used nullValue but this is not exactly what i want. I need a default value like a da

Re: Dynamic statement

2005-11-14 Thread Nathan Maves
John,The WIKI is always a great place to start :)http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Homehere is the specific FAQ about logging.http://opensource2.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+SqlMapClient+to+log+SQL+statementsTry to get that to work first.I wo

Re: Dynamic statement

2005-11-14 Thread John Chien
Nathan: How can I turn on the logging of ibatis ? The statement just does not run. I think the problem is that the three statement in the will produce something like (OR OR OR ) Thus the where clause will become like: WHERE p.CORP_ID = c.CORP_ID AND c.CORP_ID = a.CORP_ID AND (OR OR O

Re: Dynamic statement

2005-11-14 Thread Nathan Maves
First off by "not run well" do you mean that there is an error? if so please post it. Second turn on logging to make sure the sql appears as you would expect it to. Third it appears that you are sending in an array of objects as parameters. I would suggest that you use a java bean with

Dynamic statement

2005-11-14 Thread John Chien
Dear Sir: I have a question related to dynamic statement As shown below, I have a select statement for data in three tables The GUI has three input fields. Their value can not be determined before hand. Besides of doing the join of the tables, I want to have a dynamic where clause so that th

Re: Map containing Lists of Maps

2005-11-14 Thread Gary Bradshaw
OK, so this problem doesn't seem to be very high on anyone else's list. But just in case anyone else ever wants to do this, I've posted a possible patch on jira: http://issues.apache.org/jira/browse/IBATIS-221?page=all - gary ---

Re: Transaction trouble

2005-11-14 Thread Larry Meadors
Why are you doing this? It makes no sense. The purpose of the DAO pattern is to eliminate this kind of thing from your application. Write one method in your DAO to do all of this, and be done with it. Larry On 11/14/05, Corneliu Rudeanu <[EMAIL PROTECTED]> wrote: > > My intention is to mix SQL

Transaction trouble

2005-11-14 Thread Corneliu Rudeanu
My intention is to mix SQL Mapper statements with DAO accesses in the same transaction. My code could look like this: sqlMapClient.startTransaction(); sqlMapClient.update("updateUser", theUser); daoManager.getDao(UserDAO.class).load(theUser); sqlMapClient.commitTransaction(); sqlMapClient.endTran