Re: Select from View (as opposed to table) using iBatis

2010-06-09 Thread Jeff Butler
Please join us at the new project site: www.mybatis.org

Select from view is support.  The error message is Undefined Name.
DB2 cannot find the view called MY_SCHEMA.V_MY_VIEW.

Jeff Butler


On Wed, Jun 9, 2010 at 4:11 PM, mule_user s...@aol.com wrote:

 I am using iBatis (2.5) with DB2 version 8.x and Spring 2.5. Is there any
 issue in querying a view (as opposed to table)? It is a very simple select
 as:

 resultMap id=codeMap class=org.impl.CodeBean
        result column=TBL_NM      property=tableName
 typeHandler=org.our.StringTrimTypeHandler/
        result column=COL_NM     property=columnName
 typeHandler=org.our.StringTrimTypeHandler/
        result column=CD            property=code
 typeHandler=org.our.StringTrimTypeHandler/
        result column=CD_DESC   property=shortDesc
 typeHandler=org.our.StringTrimTypeHandler/
        result column=CD_LNG_DESC property=longDesc
 typeHandler=org.our.StringTrimTypeHandler/
 /resultMap

 select id=findAll resultMap=codeMap
        select CD from ${jdbc.schema}.V_MY_VIEW
 /select


 org.impl.CodeBean is a simple POJO with String attributes only with public
 getter and setter. StringTrimTypeHandler are custom code written.

 My SQL are working when I am using table, as opposed to View.

 When I call the above findAll from JUnit for View, I get exception as:


 --    Exception:  org.springframework.jdbc.BadSqlGrammarException: SQL
 MAPPING ID: code.findAll; bad SQL grammar []; nested exception is
 com.ibatis.common.jdbc.exception.NestedSQLException:

 --- The error occurred in org/.../mapping/code.xml.

 --- The error occurred while applying a parameter map.

 --- Check the code.findAll-InlineParameterMap.

 --- Check the statement (query failed).

 --- Cause: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204,
 SQLSTATE: 42704, SQLERRMC: MY_SCHEMA.V_MY_VIEW

 --    Exception Detail:
 com.ibatis.common.jdbc.exception.NestedSQLException:

 --- The error occurred in org/.../mapping/code.xml.

 I must be missing something.

 Query from View is supported in iBatis, correct?
 --
 View this message in context: 
 http://old.nabble.com/Select-from-View-%28as-opposed-to-table%29-using-iBatis-tp28835900p28835900.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Need support for Dynamic procedure invocation

2010-05-25 Thread Jeff Butler
This would be a great time to switch to mybatis and usa a
@SelectProvider to write the query exactly as you need it. I think
that the dynamic SQL tags won't work in this case.

Jeff Butler


On 5/25/10, Nicky Jha nicky@jpmchase.com wrote:
 Hi

 Is there a way I can modify {call $procedureName$ iterate property=params
 open=( close=)
  conjunction=,#params[]#/iterate } to include jdbc types also, so that
 I can pass null value to database?

 Thanks
 Nicky



 -Original Message-
 From: Nicky Jha
 Sent: Tuesday, May 25, 2010 11:12 AM
 To: 'user-java@ibatis.apache.org'
 Subject: RE: Need support for Dynamic procedure invocation

 Joe/Jeff
 Please help.

 this class is not part of framework, this is approach, we have used in case
 our procedure changes at runtime, so will its parameter.For that we using

 public class DynamicProcedureParams {
   private String procedureName;
   private ListObject params = new ArrayListObject();

   // getters and setters here
 }

 procedure id=executeCopyProcs
 parameterClass=path.to.DynamicProcedureParams
 {call $procedureName$ iterate property=params open=( close=)
 conjunction=,#params[]#/iterate }
 /procedure


 Thanks
 Nicky




 -Original Message-
 From: Clinton Begin [mailto:clinton.be...@gmail.com]
 Sent: Tuesday, May 25, 2010 11:07 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Need support for Dynamic procedure invocation

 I'm not familiar with that class, as it's not part of the framework
 (maybe post it here).  Short story is that JDBC requires nullable
 column types to be specified.  Ibatis allows for this in the parameter
 map (crack open the user guide and search for jdbcType for more).

 Cheers,
 Clinton



 On 2010-05-24, Nicky Jha nicky@jpmchase.com wrote:
 Hi

 I am using parameter class DynamicProcedureParams(as sugessted by Joe
 Gooch
 ), as my requirement was to build paramaters at run time, so with this
 approach where can I set jdbcType?

 Nicky

 From: Clinton Begin [mailto:clinton.be...@gmail.com]
 Sent: Tuesday, May 25, 2010 10:39 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Need support for Dynamic procedure invocation

 Are you setting the jdbcType in your parameter map for all nullable
 columns?

 Clinton
 On Mon, May 24, 2010 at 11:03 PM, Nicky Jha
 nicky@jpmchase.commailto:nicky@jpmchase.com wrote:

 Hi

 with approach mentioned below(DynamicProcedureParams) , I want to also
 pass
 some of parameter as null((private ListObject params = new
 ArrayListObject(); params.add(null))), but when I pass string value as
 null , it executes parametes procedure as

 call procname(?,?,?,?,?)
 Parameters: [#IMNT_RISK_SENSITIVITY, IMNT_RISK_SENSITIVITY, null, null, 0]
 Types: [java.lang.String, java.lang.String, null, null, java.lang.Byte]

 I want type to be java.lang.String instead of null(as with null, I am
 getting Unsupported SQL type 0 )

 If I pass blank string  in place of null in (private ListObject params
 =
 new ArrayListObject(); params.add()), Types become java.lang.String,
 but
 then I think it no more considers it as null.

 Please help

 Thanks
 Nicky



 -Original Message-
 From: Nicky Jha
 Sent: Friday, May 14, 2010 8:46 PM
 To: 'user-java@ibatis.apache.orgmailto:user-java@ibatis.apache.org'
 Subject: RE: Need support for Dynamic procedure invocation

 Joe/Jeff

 This worked with your suggestion.Thank you so much!!!

 Nicky

 -Original Message-
 From: Jeff Butler
 [mailto:jeffgbut...@gmail.commailto:jeffgbut...@gmail.com]
 Sent: Friday, May 14, 2010 6:31 PM
 To: user-java@ibatis.apache.orgmailto:user-java@ibatis.apache.org
 Subject: Re: Need support for Dynamic procedure invocation

 Yes - this the best approach.

 Jeff Butler


 On 5/14/10, Joe Gooch
 mrwiz...@k12system.commailto:mrwiz...@k12system.com wrote:
 I suggest going with a dynamic SQL approach in the mapped statement.

 public class DynamicProcedureParams {
   private String procedureName;
   private ListObject params = new ArrayListObject();

   // getters and setters here
 }

 procedure id=executeCopyProcs
 parameterClass=path.to.DynamicProcedureParams
 {call $procedureName$ iterate property=params open=( close=)
 conjunction=,#params[]#/iterate }
 /procedure



 Joe

 Confidentiality Notice:
 This e-mail transmission may contain confidential and legally privileged
 information that is intended only for the individual named in the e-mail
 address. If you are not the intended recipient, you are hereby notified
 that
 any disclosure, copying, distribution, or reliance upon the contents of
 this
 e-mail message is strictly prohibited. If you have received this e-mail
 transmission in error, please reply to the sender, so that proper
 delivery
 can be arranged, and please delete the message from your mail box.

 -Original Message-
 From: Nicky Jha
 [mailto:nicky@jpmchase.commailto:nicky@jpmchase.com]
 Sent: Friday, May 14, 2010 7:38 AM
 To: user-java@ibatis.apache.orgmailto:user-java@ibatis.apache.org
 Subject

Re: Need support for Dynamic procedure invocation

2010-05-25 Thread Jeff Butler
Joe - this is exactly what I was going to write next - good call!

Nicky - you might try Clinton's suggestion, but it will depend on
whether your driver allows setting a null VARCHAR for a DECIMAL
parameter.  Some will, some won't.

The @SelectProvider route is the best route if things really need to
be this dynamic (do they REALLY need to be this dynamic?)  And writing
a spring object factory for mybatis isn't that hard to do.

Jeff Butler



On Tue, May 25, 2010 at 10:04 AM, Joe Gooch mrwiz...@k12system.com wrote:
 Sure, but it'll be uglier.

 To me, your whole approach/rationale seems odd here... Procedures changing at 
 runtime like that seems like poor DB practice except for very specific 
 scenarios, and/or single threaded db usage Then again, I don't know 
 exactly what you're trying to accomplish.  So I'll try to suspend judgement.  
 But it seems to me at this point, if you're not mapping a result set, that 
 IBatis isn't really gaining you much, since you can easily fire up a 
 StringBuffer and build the statement yourself.  Probably easier than you 
 could with the IBatis XML.

 Beans/Defn:

 public class MyParam {
  public final static int VARCHAR=1;
  public final static int INTEGER=2;
  public final static int DECIMAL=3;
  private int type;
  private Object value;

  // TODO: getters/setters/constructor
 }

 public class DynamicProcedureParams {
  private String procedureName;
  private ListMyParam params = new ArrayListMyParam();

  // TODO: getters/setters/constructor
 }

 {call $procedureName$ iterate property=params open=( close=) 
 conjunction=,
  isEqual property=params[].type 
 compareValue=1#params[].value:VARCHAR#/isEqual
  isEqual property=params[].type 
 compareValue=2#params[].value:INTEGER#/isEqual
  isEqual property=params[].type 
 compareValue=3#params[].value:DECIMAL#/isEqual
 /iterate }



 However, in JDBC you're looking like this:
  DynamicProcedureParams dpp = // your stuff;
  Connection con = // your connection;

  StringBuffer sb = new StringBuffer(1000).append({call 
 ).append(dpp.getProcedureName()).append( ();
  for(int i=0; idpp.getParams().size(); i++) {
    if (i0) sb.append(,);
    sb.append(?);
  }
  sb.append()});
  PreparedStatement st = con.prepareStatement(sb.toString());
  // You could now cache this prepared statement until/unless your dpp values 
 change
  for(int i=0; idpp.getParams().size(); i++) {
    switch(dpp.getParams().get(i).getType()) {
      case MyParam.VARCHAR: st.setString(i+1, 
 dpp.getParams().get(i).getValue()); break;
      case MyParam.INTEGER: st.setInt(i+1, dpp.getParams().get(i).getValue()); 
 break;
      case MyParam.DECIMAL: st.setDouble(i+1, 
 dpp.getParams().get(i).getValue()); break;
    }
  }
  ResultSet rs = st.executeQuery();  // or st.execute();


 If you really need to do this type of thing, it seems to me like you're going 
 to be better off creating a class and beans to hold the procedure name and 
 parameter types, and when that changes, recompile the prepared statement.  
 And then have a separate class that holds parameter values for a single 
 execution.  Then the stringbuffer bits above can be split from individual 
 queries, and only need to happen when the underlying schema changes. (Of 
 course you'll need synchronization)

 Similarly, you could do as Jeff suggested and use a SelectProvider to build 
 the SQL, effectively doing the caching bits above.

 I guess at this point it would help to know what IBatis is really buying you.

 Joe

 Confidentiality Notice:
 This e-mail transmission may contain confidential and legally privileged 
 information that is intended only for the individual named in the e-mail 
 address. If you are not the intended recipient, you are hereby notified that 
 any disclosure, copying, distribution, or reliance upon the contents of this 
 e-mail message is strictly prohibited. If you have received this e-mail 
 transmission in error, please reply to the sender, so that proper delivery 
 can be arranged, and please delete the message from your mail box.


 -Original Message-
 From: Nicky Jha [mailto:nicky@jpmchase.com]
 Sent: Tuesday, May 25, 2010 3:59 AM
 To: user-java@ibatis.apache.org
 Subject: RE: Need support for Dynamic procedure invocation

 Hi

 Is there a way I can modify {call $procedureName$ iterate
 property=params open=( close=)
  conjunction=,#params[]#/iterate } to include jdbc types also, so
 that I can pass null value to database?

 Thanks
 Nicky



 -Original Message-
 From: Nicky Jha
 Sent: Tuesday, May 25, 2010 11:12 AM
 To: 'user-java@ibatis.apache.org'
 Subject: RE: Need support for Dynamic procedure invocation

 Joe/Jeff
 Please help.

 this class is not part of framework, this is approach, we have used in
 case our procedure changes at runtime, so will its parameter.For that
 we using

 public class DynamicProcedureParams {
    private String procedureName;
    private ListObject params = new ArrayListObject();
 
    // getters and setters

Re: iBATIS 3 @InsertProvider (and other @*Provider) annotation question

2010-05-21 Thread Jeff Butler
Not right - the parameter object on the interface method is passed to
the *Provider method:

// interface...
@InsertProvider(type=MyProvider.class, method=myInsert)
int insertFoo(Foo foo);


// provider method...
public String myInsert(Foo foo) {
 
}

Works like a charm.

BTW - join us at the new project - www.mybatis.org
New mailing list: http://groups.google.com/group/mybatis-user


Jeff Butler




On Fri, May 21, 2010 at 9:23 AM, Alex Sherwin
alex.sher...@acadiasoft.com wrote:
 I just want to make sure, but there is there simply no way to pass arguments
 to the sql provider method defined in the annotations such as
 @InsertProvider?

 It would be very beneficial to be able to do so in terms of building dynamic
 sql, such as an insert statements for a dynamic number of rows

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator download

2010-05-20 Thread Jeff Butler
I usually add these types of methods directly to the generated
classes.  In my experience, it's pretty rare to have to regenerate
classes.  If you use Ibator through the eclipse plugin, then the added
methods will even survive a regeneration.  Here's documentation for
building a new version of the Eclipse plugin if you are interested:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html

I'd not recommend the interfaces route - I went down that rabbit hole
myself onetime and lived to regret it.

Search/replace - tedious but effective.

Jeff Butler



On Wed, May 19, 2010 at 4:30 PM, Roy Bailey t...@roybailey.info wrote:
 Thanks Jeff,

 I've been able to follow the instructions and generate Ibatis 3 mappers from
 Ibator 1.2.2 build.  Great job.

 I've also been looking around the Ibator code because I want to use extended
 classes for result-sets (e.g. classes that extend the Ibator generated
 classes and add derived methods and/or nice toString() etc.).  Easiest way
 seems to be to search/replace the code generated with different package,
 where I define the extended versions.  Another thought was to generate/use
 interfaces with all the getter/setter type methods, as this would allow for
 other classes to be passed to native Ibator mappers instead of forcing the
 creation/population of Ibator concrete classes.  Low priority, but any
 suggestions or thoughts?

 regards...
 Roy


 On 10/05/2010 22:43, Jeff Butler wrote:

 stable is strictly in the opinion of the user :)  I've been using it
 for many weeks and it seems stable to me.

 Honestly, I don't know when I'll get to publishing it.  Whenever I
 give a date, I miss it by a mile - for lots of reasons, mainly that it
 takes more time than I seem to have.

 It's very easy to build yourself with Maven.  I wrote some directions
 here:


 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html

 Jeff Butler



 On Mon, May 10, 2010 at 4:31 PM, Roy Baileyt...@roybailey.info  wrote:


 Any idea when a version of Ibator for iBatis 3 will be ready for
 download?

 I'd be really interested in stable milestone of the ibator to go with the
 testing of iBatis 3, especially as I'm starting to spend a lot of time on
 basic table crud.

 thanks...Roy
 P.S. I don't use maven, but if the instructions are simple I can give it
 a
 go.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: contextGenerateAdditionalXmlFiles to create single file

2010-05-18 Thread Jeff Butler
Take a look at the source for SqlMapConfigPlugin - it does something
very similar to what you are trying to accomplish.

Jeff Butler


On Mon, May 17, 2010 at 4:08 AM, Amar X Hussain
amar.huss...@jpmorgan.com wrote:
 Hi guys,



 I have an Ibator plugin that creates a spring config file per table, it
 works fine but I wanted to know if there was a way a could modify it to
 create a single file for all tables instead.



 Thanks,

 Amar!



 import java.util.ArrayList;

 import java.util.List;



 import org.apache.ibatis.ibator.api.GeneratedXmlFile;

 import org.apache.ibatis.ibator.api.IbatorPluginAdapter;

 import org.apache.ibatis.ibator.api.IntrospectedTable;

 import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;

 import org.apache.ibatis.ibator.api.dom.xml.Attribute;

 import org.apache.ibatis.ibator.api.dom.xml.Document;

 import org.apache.ibatis.ibator.api.dom.xml.XmlElement;



 public class SpringTableConfigPlugin extends IbatorPluginAdapter {



     TopLevelClass topLevelClass;

     String fileName;

     String targetPackage = config.spring;

     String targetProject = C:/workspace/ibatisproj;

     boolean isMergeable = false;



     public boolean validate(ListString arg0) {

     return true;

     }



     public ListGeneratedXmlFile
 contextGenerateAdditionalXmlFiles(IntrospectedTable introspectedTable) {



     String domainObjectName =
 introspectedTable.getFullyQualifiedTable().getDomainObjectName();



     fileName =
 Spring+domainObjectName+Config.xml;



     Document document = new Document();



     XmlElement rootElement = new
 XmlElement(beans);



     rootElement.addAttribute(new
 Attribute(xmlns, http://www.springframework.org/schema/beans;));

     rootElement.addAttribute(new
 Attribute(xmlns:xsi, http://www.w3.org/2001/XMLSchema-instance;));

     rootElement.addAttribute(new
 Attribute(xmlns:aop, http://www.springframework.org/schema/aop;));

     rootElement.addAttribute(new
 Attribute(xmlns:tx, http://www.springframework.org/schema/tx;));

     rootElement.addAttribute(new
 Attribute(xmlns:context,
 http://www.springframework.org/schema/context;));

     rootElement.addAttribute(new
 Attribute(xsi:schemaLocation, http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd\nhttp://www.springframework.org/schema/tx
 http://www.springframework.org/schema/tx/spring-tx-2.0.xsd\nhttp://www.springframework.org/schema/aop
 http://www.springframework.org/schema/aop/spring-aop-2.0.xsd\nhttp://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context-2.5.xsd;));



     document.setRootElement(rootElement);



     XmlElement beanElement = new
 XmlElement(bean);

     beanElement.addAttribute(new Attribute(id,
 domainObjectName));

     beanElement.addAttribute(new
 Attribute(class,
 com.test.ibatisproj.daoImpl.+domainObjectName+DAOImpl));



     XmlElement propertyElement = new
 XmlElement(property);

     propertyElement.addAttribute(new
 Attribute(name, sqlMapClient));

     propertyElement.addAttribute(new
 Attribute(ref, sqlMapClient));



     beanElement.addElement(propertyElement);



     rootElement.addElement(beanElement);



     ListGeneratedXmlFile generatedXmlFileList
 = new ArrayListGeneratedXmlFile();



     GeneratedXmlFile springTableConfigXml = new
 GeneratedXmlFile(document, fileName, targetPackage, targetProject,
 isMergeable );




 generatedXmlFileList.add(springTableConfigXml);



     return generatedXmlFileList;



     }



 }

 This email is confidential and subject to important disclaimers and
 conditions including on offers for the purchase or sale of securities,
 accuracy and completeness of information, viruses, confidentiality, legal
 privilege, and legal entity disclaimers, available at
 http://www.jpmorgan.com/pages/disclosures/email.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Need support for Dynamic procedure invocation

2010-05-14 Thread Jeff Butler
This won't work (as you've discovered).  iBATIS 2.x does not reparse
the string for variables after string substitution.  You'll need to do
this with the dynamic tags, or you'll need to compose the entire
string (including parameter values - like {call myproc('fred')}).

Jeff Butler


On Fri, May 14, 2010 at 4:12 AM, Nicky Jha nicky@jpmchase.com wrote:
 Hi Team,



 I am having hard time resolving following issue.Please help.

 We are using Ibatis 2.X.

 In our application we want capability to invoke stored procedure by reading
 it from property xml file.We provide procedure name parameters, parameters
 type to  property xml file.

 Now from this xml file I have created one dynamic procedure string like
 procedureName(#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1#).

 Now I want to call this procedure from Ibatis SQL mapping XML like this



 procedure id=executeCopyProcs
 parameterClass=com.jpmorgan.pyramid.pyrsyst.configure.ProcParameterMapper

 {call $procedureName$ }



 /procedure



 Please refer below for ProcParameterMapper class. Now as soon as iBatis sees
  $procedureName$, it replaces it with say
 (#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1#) but it does
 not replace the placeHolder(#), it passes on this as it is.Which is a issue.



 If we type
 procedureName(#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1)
 directly into SQL mapping XML, it replaces place holder, but with string
 substitution , it does not work.We can't type directly into mapping xML, as
 this string is composed at run time.Also dynamic tags are not of help, as
 logic to create
 (#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1#) complex
 procedure with different types of parameter can't be written in mapping
 XML.At least I am unable to do.



 I am really struck.Please suggest us the best way to deal with it.













 package com.jpmorgan.pyramid.pyrsyst.configure;



 import java.lang.reflect.Field;



 public class ProcParameterMapper {



   StringBuffer procedureName = new StringBuffer();

   boolean firstParam = true;

   boolean lastParam = false;



   String stringVal1;

   String stringVal2;

   String stringVal3;

   String stringVal4;

   String stringVal5;

   String stringVal6;

   String stringVal7;

   String stringVal8;

   String stringVal9;

   String stringVal10;



   int intVal1;

   int intVal2;

   int intVal3;

   int intVal4;

   int intVal5;

   int intVal6;

   int intVal7;

   int intVal8;

   int intVal9;

   int intVal10;



   byte byteVal1;

   byte byteVal2;

   byte byteVal3;

   byte byteVal4;

   byte byteVal5;



   public void setStringVal(String value, int count,String jdbcType)
 throws ConfigureException {



     Field[] field = ProcParameterMapper.class.getDeclaredFields();



     for (int i = 0; i  field.length; i++) {

   try {

     if
 (field[i].getName().endsWith(String.valueOf(count))

      (String)


 .equals(field[i].getType().getSimpleName())) {

   field[i].set(this, value);

   if (firstParam) {

     procedureName.append((# +
 field[i].getName()+#);

     firstParam = false;

   } else if (lastParam) {

     procedureName.append(,# +
 field[i].getName() +#));

   } else {

     procedureName.append(,# +
 field[i].getName()+#);

   }

   break;



     }

   } catch (Exception e) {

     throw new ConfigureException(

     Exception setting String value in
 paramMapper

     + e.getStackTrace());

   }



     }



   }



   public void setIntVal(int value, int count,String jdbcType) throws
 ConfigureException {



     Field[] field = ProcParameterMapper.class.getDeclaredFields();



     for (int i = 0; i  field.length; i++) {

   try {

     if
 (field[i].getName().endsWith(String.valueOf(count))

     
 (int).equals(field[i].getType().getSimpleName())) {



   field[i].set(this, value);

   if (firstParam) {

     procedureName.append((# +
 field[i].getName()+#);

     firstParam = false;

   } else if (lastParam) {

     procedureName.append(,# +
 field[i].getName

Re: Need support for Dynamic procedure invocation

2010-05-14 Thread Jeff Butler
Yes - this the best approach.

Jeff Butler


On 5/14/10, Joe Gooch mrwiz...@k12system.com wrote:
 I suggest going with a dynamic SQL approach in the mapped statement.

 public class DynamicProcedureParams {
   private String procedureName;
   private ListObject params = new ArrayListObject();

   // getters and setters here
 }

 procedure id=executeCopyProcs
 parameterClass=path.to.DynamicProcedureParams
 {call $procedureName$ iterate property=params open=( close=)
 conjunction=,#params[]#/iterate }
 /procedure



 Joe

 Confidentiality Notice:
 This e-mail transmission may contain confidential and legally privileged
 information that is intended only for the individual named in the e-mail
 address. If you are not the intended recipient, you are hereby notified that
 any disclosure, copying, distribution, or reliance upon the contents of this
 e-mail message is strictly prohibited. If you have received this e-mail
 transmission in error, please reply to the sender, so that proper delivery
 can be arranged, and please delete the message from your mail box.

 -Original Message-
 From: Nicky Jha [mailto:nicky@jpmchase.com]
 Sent: Friday, May 14, 2010 7:38 AM
 To: user-java@ibatis.apache.org
 Subject: RE: Need support for Dynamic procedure invocation

 Hi Jeff,

 Thanks for this, if I was to do as suggested and compose the entire
 string with parameter values, how will the parameter types (e.g. date,
 smallint etc) be handled?

 Nicky!

 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, May 14, 2010 4:53 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Need support for Dynamic procedure invocation

 This won't work (as you've discovered).  iBATIS 2.x does not reparse
 the string for variables after string substitution.  You'll need to do
 this with the dynamic tags, or you'll need to compose the entire
 string (including parameter values - like {call myproc('fred')}).

 Jeff Butler


 On Fri, May 14, 2010 at 4:12 AM, Nicky Jha nicky@jpmchase.com
 wrote:
  Hi Team,
 
 
 
  I am having hard time resolving following issue.Please help.
 
  We are using Ibatis 2.X.
 
  In our application we want capability to invoke stored procedure by
 reading
  it from property xml file.We provide procedure name parameters,
 parameters
  type to  property xml file.
 
  Now from this xml file I have created one dynamic procedure string
 like
 
 procedureName(#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal
 1#).
 
  Now I want to call this procedure from Ibatis SQL mapping XML like
 this
 
 
 
  procedure id=executeCopyProcs
 
 parameterClass=com.jpmorgan.pyramid.pyrsyst.configure.ProcParameterMap
 per
 
  {call $procedureName$ }
 
 
 
  /procedure
 
 
 
  Please refer below for ProcParameterMapper class. Now as soon as
 iBatis sees
   $procedureName$, it replaces it with say
  (#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1#) but it
 does
  not replace the placeHolder(#), it passes on this as it is.Which is a
 issue.
 
 
 
  If we type
 
 procedureName(#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal
 1)
  directly into SQL mapping XML, it replaces place holder, but with
 string
  substitution , it does not work.We can't type directly into mapping
 xML, as
  this string is composed at run time.Also dynamic tags are not of
 help, as
  logic to create
  (#stringVal1#,#stringVal2#,#stringVal3#,#intVal1#,#byteVal1#) complex
  procedure with different types of parameter can't be written in
 mapping
  XML.At least I am unable to do.
 
 
 
  I am really struck.Please suggest us the best way to deal with it.
 
 
 
 
 
 
 
 
 
 
 
 
 
  package com.jpmorgan.pyramid.pyrsyst.configure;
 
 
 
  import java.lang.reflect.Field;
 
 
 
  public class ProcParameterMapper {
 
 
 
    StringBuffer procedureName = new StringBuffer();
 
    boolean firstParam = true;
 
    boolean lastParam = false;
 
 
 
    String stringVal1;
 
    String stringVal2;
 
    String stringVal3;
 
    String stringVal4;
 
    String stringVal5;
 
    String stringVal6;
 
    String stringVal7;
 
    String stringVal8;
 
    String stringVal9;
 
    String stringVal10;
 
 
 
    int intVal1;
 
    int intVal2;
 
    int intVal3;
 
    int intVal4;
 
    int intVal5;
 
    int intVal6;
 
    int intVal7;
 
    int intVal8;
 
    int intVal9;
 
    int intVal10;
 
 
 
    byte byteVal1;
 
    byte byteVal2;
 
    byte byteVal3;
 
    byte byteVal4;
 
    byte byteVal5;
 
 
 
    public void setStringVal(String value, int count,String
 jdbcType)
  throws ConfigureException {
 
 
 
      Field[] field =
 ProcParameterMapper.class.getDeclaredFields();
 
 
 
      for (int i = 0; i  field.length; i++) {
 
    try {
 
      if
  (field[i].getName().endsWith(String.valueOf(count

Re: Way to use sql in mapper interface, without having to create a corresponding xml mapping file?

2010-05-13 Thread Jeff Butler
It took me a while to figure it out also!

Create your SqlSessionFactory as normal, then add the interfaces manually:

 sqlSessionFactory.getConfiguration().addMapper(SomeMapperInterface.class);

Jeff Butler


On Wed, May 12, 2010 at 4:16 PM, Rick R ric...@gmail.com wrote:
 Larry showed me his cool no xml config setup which I'd love to implement at
 some point.

 For this current project using ibatis3 it's too late to refactor a real lot
 at this stage and we're using your typical sqlMapConfig file.  Overall we
 still prefer to code all of our sql in xml files, but I just recently
 decided to create some sql using the annotation-based approach in an
 interface mapper file.

 The problem (?) is that even though all the sql is in this mapper interface,
 I seem to still have to declare a dummy corresponding mapping xml file just
 to declare the interface namespace (otherwise ibatis at runtime bitches
 about not being able to find the mapping.)  I looked over the ibatis3 pdf
 and under the annotation approach section for using Mappers it doesn't
 really mention that you need the corresponding mapping.xml file, so I'm
 probably just missing something stupid?

 Shouldn't there be a way in the SqlMapConfig to declare Use this interface
 mapper ? Basically I was thinking in the mapper section of the config
 instead of having to use:

 mappers
    mapper resource=mapper-files/metadb/DataReleaseMapper.xml/

 You could also include:

 mappers
    mapper class=com.foobar.mapper.DataReleaseMapper/

 As it is now, I'm having to declare that silly DataReleaseMapper.xml which
 only ends up wrapping my interface Mapper.


 ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE mapper
     PUBLIC -//ibatis.apache.org//DTD Mapper 3.0//EN
     http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd;

  mapper
 namespace=com.foo.dataselector.media.service.mapper.DataReleaseMapper

 /mapper

 My assumption is that I'm missing something obvious:)


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: New to Ibatis / Ibator / Eclipse

2010-05-12 Thread Jeff Butler
Dude - please stop sending the same email over and over again!

Read the iBATIS documentation, do a google search for ibatis tutorial, etc.

Jeff Butler


On Wed, May 12, 2010 at 10:36 AM, SMe Software - Rocky Castaneda
rcastan...@smartermanager.com wrote:

 Hi Clinton,
 I have a table named TIMMAIN and I have successfully ran Ibator in eclipse
 and generated the following structure:
 com.mycompany.dao
          TIMMAINDAO.java
 com.mycompany.dao.ibatis.ibatis.maps
          TIMMAIN_SqlMap.xml
 com.smartermanager.dao.ibatis.impl
          TIMMAINDAOImpl.java
 com.smartermanager.vo
          TIMMAIN.java
          TIMMAINExample.java
 Any help on what I should do next with these ibator code?
 Can you point me to a simple yet functional example how to use these files
 generated by ibator?
 An example on how to use ibator generated code on just one table?
 Can we directly use the ibator generated code in prototyping through a JSP
 scriptlet?
 Any help pls tnx,
 rocky


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator download

2010-05-10 Thread Jeff Butler
stable is strictly in the opinion of the user :)  I've been using it
for many weeks and it seems stable to me.

Honestly, I don't know when I'll get to publishing it.  Whenever I
give a date, I miss it by a mile - for lots of reasons, mainly that it
takes more time than I seem to have.

It's very easy to build yourself with Maven.  I wrote some directions here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html

Jeff Butler



On Mon, May 10, 2010 at 4:31 PM, Roy Bailey t...@roybailey.info wrote:
 Any idea when a version of Ibator for iBatis 3 will be ready for download?

 I'd be really interested in stable milestone of the ibator to go with the
 testing of iBatis 3, especially as I'm starting to spend a lot of time on
 basic table crud.

 thanks...Roy
 P.S. I don't use maven, but if the instructions are simple I can give it a
 go.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Converting ibator generated iterate clause in iBATIS 2 to iBATIS 3.0

2010-05-07 Thread Jeff Butler
There's nothing automatic.  The easiest thing to do is regenerate the
the code with the (as yet unreleased) new version of Ibator.  It's
very easy to build with Maven - I'm just struggling to find time to
deal with the all too cumbersome Apache release process.

I've done some thinking about an ibatis2-ibatis3 XML conversion tool
- but it's a very difficult thing to do because the dynamic SQL
elements are very different.  There's no easy answer for that.

Jeff Butler




On Thu, May 6, 2010 at 11:56 PM, Don's Email don.cl...@sbcglobal.net wrote:
 I used ibator 1.2 to create the SQL mapper files for a project.  I am trying
 to convert the mapper files to iBATIS 3.0, but am stuck on the iterate
 tags.  Are there any examples available or a How to for converting mapper
 files to iBATIS 3.0?

  sql id=abatorgenerated_Example_Where_Clause
    !--
      WARNING - This element is automatically generated by Abator for
 iBATIS, do not modify.
      This element was generated on Sat Oct 25 15:05:38 PDT 2008.
    --
    iterate conjunction=or prepend=where property=oredCriteria
 removeFirstPrepend=iterate
      isEqual compareValue=true property=oredCriteria[].valid
        (
        iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithoutValue
          $oredCriteria[].criteriaWithoutValue[]$
        /iterate
        iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithSingleValue
          $oredCriteria[].criteriaWithSingleValue[].condition$
            #oredCriteria[].criteriaWithSingleValue[].value#
        /iterate
        iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithListValue
          $oredCriteria[].criteriaWithListValue[].condition$
          iterate close=) conjunction=, open=(
 property=oredCriteria[].criteriaWithListValue[].values
            #oredCriteria[].criteriaWithListValue[].values[]#
          /iterate
        /iterate
        iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithBetweenValue
          $oredCriteria[].criteriaWithBetweenValue[].condition$
          #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
          #oredCriteria[].criteriaWithBetweenValue[].values[1]#
        /iterate
        )
      /isEqual
    /iterate
  /sql

 Thank you!

 Don


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Strange problem with resultMaps

2010-05-06 Thread Jeff Butler
If you specify a resultMap, you need to specify a complete result map
- including all the fields from User.

Previously when you were not specifying a resultMap, iBATIS was
building one for you on the fly by introspecting the User class.  But
since you are now specifying the map yourself, iBATIS assumes it is
complete.

Jeff Butler


On Thu, May 6, 2010 at 5:27 AM, Metsovuori Juho
juho.metsovu...@iltalehti.fi wrote:
 Hey all,

 I have a this strange problem with resultMaps. When I use the query below to 
 retrieve a users information, everything works great.

    public class User

        private int id = 0;
        private String username = ;
        private String password = ;
        private Timestamp registeredAt;
        private Timestamp lastLogin;
        private ListUser friends = new ArrayListUser();

    sql id=table
        users
        /sql

    select id=getUser parameterType=java.lang.String resultType=User
            SELECT * FROM include refid=table/ WHERE username = #{username}
      /select

 But I need to add a resultMap, see below, to retrieve all the users friends. 
 When I use this resultMap, I don't get any of the users friends or even the 
 users own username, but I DO get the users password and other info. So do you 
 have any ideas why this doesn't work, and why I don't get the users username. 
 The actualy sql queries do work, I tested them manually.

    resultMap id=friendByUsernameMap type=User
            association property=friends
                    column=username
                    javaType=java.util.ArrayList
                     
 select=eventstream.model.mapper.UserMapper.getFriendsByUsername /
    /resultMap

    select id=getFriendsByUsername
        parameterType=java.lang.String
        resultType=User
            SELECT * FROM include refid=table/
            WHERE id IN
                (SELECT userFriendId
                FROM users_to_users, users
                WHERE users.username = #{username}
                AND users_to_users.userId = users.id)
        /select

 Thanks
 Juho

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Help with iBatis nested iterate syntax

2010-05-05 Thread Jeff Butler
I think your issue relates to a misunderstanding about the property
attribute.  I see that you have added ReportParameters at the front
of all your property references.  My guess is that you don't need
that.  iBATIS would expect ReportParameters to be a property of your
parameter object - and I'm guessing that ReportParameters IS your
parameter object.  So,  remove ReportParameters and things will
likely improve.

Jeff Butler

On Wed, May 5, 2010 at 8:42 AM, devver kmg...@googlemail.com wrote:

 Thanks for your reply Jeff

 I am using something very similar (See below) but I am getting a host of
 error messages, including:

 --- Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal
 list from JavaBean. Cause java.lang.NumberFormatException: For input string:
 
 Caused by: java.lang.NumberFormatException: For input string: ; nested
 exception is com.ibatis.common.jdbc.exception.NestedSQLException:

 followed by:

  com.ibatis.common.beans.ProbeException: Error getting ordinal list from
 JavaBean. Cause java.lang.NumberFormatException: For input string: 

 These are repeated several times.

 I pass a HashMap into the SQLMap. One of the instances is a ReportParameters
 instance. This is comprised of several properties but the important one as
 far as my SQL is concerned is an array of objects which themselves contain
 an array.

 My SQLMap dynanically builds a WHERE clause based on the ReportParameters
 'outer' and 'inner' arrays. The dynamic block looks similar to this:

 iterate prepend=AND property=ReportParameters.outerArray
 conjunction=OR open=( close=)
                (
                #ReportParameters.outerArray[].someProperty#
                ...

                )
                iterate prepend=AND 
 property=ReportParameters.outerArray[].innerArray
 conjunction=AND open=( close=)
                        (
                           
 #ReportParameters.outerArray[].innerArray[].anotherProperty#
                        )
                /iterate
        )
 /iterate

 I'm not sure why this is happening at all. The syntax looks straight-forward
 and intuitive and yet it (or something) appears to crash iBatis.
 I have dumped the contents of ReportParameters just before I execute the SQL
 via my DAO. Everything looks as expected.

 The version of iBatis I am using is v2. The app uses ibatis-common-2.jar and
 ibatis-sqlmap-2.jar

 Jeff Butler-2 wrote:

 Assuming MyParameters is some object passed as a parameter object, and
 that myOuterList is a property of MyParameters:

 iterate property=myOuterList ...
   iterate property=myOuterList[].myInnerList...
     #myOuterList[].myInnerList[].myProperty#
   /iterate
 /iterate


 Jeff Butler


 On Tue, May 4, 2010 at 2:09 PM, devver kmg...@googlemail.com wrote:

 Hi

 #Subsequent to the problems outline in this post:
 http://old.nabble.com/Problem-accessing-List-instance-property-via-%3Cisnull%3E-td28368852.html

 ... the problem has changed somewhat. The orignal SQL statement has been
 altered and we now have a structure which requries nested iterate
 elements.

 It looks like patches may have been introduced into IbAtis 2.x around
 2006
 to enable this feature but I can't get it to work. Can someone please
 confirm the correct syntax? I had used somethign similar to this:

 iterate property=MyParameters.myOuterList conjunction=OR open=(
 close=)
     !-- Some SQL --

     iterate proeprty =MyParameters.myOuterList[].myInnerList
 conjunction=AND open=( close=)

     !-- More SQL where I access
 #MyParameters.myOuterList.myInnerList[].myProperty# --

     /iterate

 /iterate

 Any help gratefully received. Thanks
 --
 View this message in context:
 http://old.nabble.com/Help-with-iBatis-nested-%3Citerate%3E-syntax-tp28451833p28451833.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 View this message in context: 
 http://old.nabble.com/Help-with-iBatis-nested-%3Citerate%3E-syntax-tp28451833p28461065.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: date in where clause does not work.

2010-05-05 Thread Jeff Butler
(a)ibator converts these to java.sql.Date to force iBATIS to use the
DateOnlyTypeHandler for database fields that are truly just dates -
not date/time or timestamp.  This is working in lots of tests.

What is the type of the database field?  Is it truly just a date, or
is it a timestamp?

Also, in these types of situations, it's best to turn on logging to
see the actual SQL being sent - that usually leads to an Aha moment.

Jeff Butler




On Wed, May 5, 2010 at 3:50 AM, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Today, I'm having other kind of pb...
 My select request return too much rows..
 I'm still lauching the same test.. and, in debug mode, i've seen something
 wrong here :

       protected void addCriterionForJDBCDate(String condition, Date value,
 String property) {
            addCriterion(condition, new java.sql.Date(value.getTime()), 
 property);
        }

        protected void addCriterion(String condition, Object value, String
 property) {
            if (value == null) {
                throw new RuntimeException(Value for  + property +  cannot 
 be null);
            }
            MapString, Object map = new HashMapString, Object();
            map.put(condition, condition);
            map.put(value, value);
            criteriaWithSingleValue.add(map);
        }

 This is a generated method (abator).
 The Date value I passed in the method, is a new java.util.Date().

 And it's converted as : 1970-01-01 ...

 why ?
 I guess the value.getTime() is doing something wrong.




 Jeremy Jardin wrote:

 well, sure, I _always_ use java.util.Date..
 My sqlMap is an abatorGenerated one.. and it's quite big.

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE sqlMap PUBLIC -//ibatis.apache.org//DTD SQL Map 2.0//EN
 http://ibatis.apache.org/dtd/sql-map-2.dtd;
 sqlMap namespace=TAB_CHIF
   resultMap
 class=fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChif
 id=ibatorgenerated_BaseResultMap
     !--
       WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
       This element was generated on Tue May 04 16:23:34 CEST 2010.
     --
     result column=DAT_CHIF jdbcType=DATE property=datChif /
     result column=MOIS_CHIF jdbcType=CHAR property=moisChif /
     result column=AN_CHIF jdbcType=CHAR property=anChif /
   /resultMap
   sql id=ibatorgenerated_Example_Where_Clause
     !--
       WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
       This element was generated on Tue May 04 16:23:34 CEST 2010.
     --
     iterate conjunction=or prepend=where property=oredCriteria
 removeFirstPrepend=iterate
       isEqual compareValue=true property=oredCriteria[].valid
         (
         iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithoutValue
           $oredCriteria[].criteriaWithoutValue[]$
         /iterate
         iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithSingleValue
           $oredCriteria[].criteriaWithSingleValue[].condition$
             #oredCriteria[].criteriaWithSingleValue[].value#
         /iterate
         iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithListValue
           $oredCriteria[].criteriaWithListValue[].condition$
           iterate close=) conjunction=, open=(
 property=oredCriteria[].criteriaWithListValue[].values
             #oredCriteria[].criteriaWithListValue[].values[]#
           /iterate
         /iterate
         iterate conjunction=and prepend=and
 property=oredCriteria[].criteriaWithBetweenValue
           $oredCriteria[].criteriaWithBetweenValue[].condition$
           #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
           #oredCriteria[].criteriaWithBetweenValue[].values[1]#
         /iterate
         )
       /isEqual
     /iterate
   /sql
   select id=ibatorgenerated_selectByExample
 parameterClass=fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChifExample
 resultMap=ibatorgenerated_BaseResultMap
     !--
       WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
       This element was generated on Tue May 04 16:23:34 CEST 2010.
     --
     select DAT_CHIF, MOIS_CHIF, AN_CHIF
     from TAB_CHIF
     isParameterPresent
       include refid=TAB_CHIF.ibatorgenerated_Example_Where_Clause /
       isNotNull property=orderByClause
         order by $orderByClause$
       /isNotNull
     /isParameterPresent
   /select
 /sqlMap


 nmaves wrote:

 Wel ALWAYS use java.util.Date

 send us your sqlmap


 On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin
 jeremy.jar...@gmail.comwrote:


 Ok, I'm doing something like that.

 TabChifExample criteria = new TabChifExample();
 criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
 .. etc...

 I've seen in the example class that the java.util.Date is casted in
 java.sql.Date..



 Larry Meadors wrote:
 
  Hm, odd - I've done this hundreds of times with oracle - just passing

Re: Does anyone have any example of foreach with annotation

2010-05-05 Thread Jeff Butler
IIRC, iBATIS doesn't support dynamic SQL in annotations.  You'll need
to use an @UpdateProvider and generate the dynamic SQL yourself.

Jeff

On Wed, May 5, 2010 at 2:18 AM, shamim sre...@yandex.ru wrote:

 Hi All,
  i have stuck with dynamic Sql on Ibatis 3 annotations. Trying to pass List
 in dynamic sql as follows:

 @Update(update ${schemaName}.fuf uf +
                         set uf.reestr_date = #{reestDate}, +
                         uf.reestr_number = #{reestNum} +
                         where uf.reestr_number IS not NULL AND 
 uf.reestr_date IS not NULL and
 uf.id in  +
                         foreach item=\item\ index=\index\ 
 collection=\list\+
                               open=\(\ separator=\,\ close=\)\+
                               #{item}+
                         /foreach)
        void updateUpffReesterByList(@Param(schemaName) final String 
 schemaName,
 @Param(list) ListLong list, @Param(reestNum) final String reestNum,
 @Param(reestDate) final Date reestDate);

 Its always throws JDBC exception. May be i am missing something?
 Thank'x in Advance
  Shamim


 --
 View this message in context: 
 http://old.nabble.com/Does-anyone-have-any-example-of-%22foreach%22-with-annotation-tp28457518p28457518.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Help with iBatis nested iterate syntax

2010-05-04 Thread Jeff Butler
Assuming MyParameters is some object passed as a parameter object, and
that myOuterList is a property of MyParameters:

iterate property=myOuterList ...
  iterate property=myOuterList[].myInnerList...
#myOuterList[].myInnerList[].myProperty#
  /iterate
/iterate


Jeff Butler


On Tue, May 4, 2010 at 2:09 PM, devver kmg...@googlemail.com wrote:

 Hi

 #Subsequent to the problems outline in this post:
 http://old.nabble.com/Problem-accessing-List-instance-property-via-%3Cisnull%3E-td28368852.html

 ... the problem has changed somewhat. The orignal SQL statement has been
 altered and we now have a structure which requries nested iterate
 elements.

 It looks like patches may have been introduced into IbAtis 2.x around 2006
 to enable this feature but I can't get it to work. Can someone please
 confirm the correct syntax? I had used somethign similar to this:

 iterate property=MyParameters.myOuterList conjunction=OR open=(
 close=)
     !-- Some SQL --

     iterate proeprty =MyParameters.myOuterList[].myInnerList
 conjunction=AND open=( close=)

     !-- More SQL where I access
 #MyParameters.myOuterList.myInnerList[].myProperty# --

     /iterate

 /iterate

 Any help gratefully received. Thanks
 --
 View this message in context: 
 http://old.nabble.com/Help-with-iBatis-nested-%3Citerate%3E-syntax-tp28451833p28451833.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



SelectBuilder

2010-04-28 Thread Jeff Butler
I've been playing with SelectBuilder.  I like it, and I just added
support for the DISTINCT keyword.

Just wondering... Clinton - did you consider doing DeleteBuilder,
InsertBuilder, UpdateBuilder?  I'd be happy to work on them if you are
open to it.

Jeff Butler

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



iBATIS 3 Live

2010-04-22 Thread Jeff Butler
Hi All,

I wanted to let everyone know that we've deployed our first production
web application using iBATIS version 3 and all is working very well.
It's running in WebSphere (no EJBs) and hitting a very difficult DB2
database.  We also used Ibator to generate almost all of the queries -
which saved us a huge amount of startup time.

So in my humble opinion, iBATIS 3 is good to go!

Jeff Butler

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBATIS 3 Live

2010-04-22 Thread Jeff Butler
Not me.

Jeff Butler


On 4/22/10, Clinton Begin clinton.be...@gmail.com wrote:
 Do either of you use ManagedTransaction?

 Clinton

 On Thu, Apr 22, 2010 at 12:38 PM, Guy Rouillier
 guyr-...@burntmail.comwrote:

 We've had our production customer portal running with iBATIS beta 7 for 3
 months now ;)  Working great, but obviously would like to upgrade to a GA
 version for our next point release.


 On 4/22/2010 11:15 AM, Jeff Butler wrote:

 Hi All,

 I wanted to let everyone know that we've deployed our first production
 web application using iBATIS version 3 and all is working very well.
 It's running in WebSphere (no EJBs) and hitting a very difficult DB2
 database.  We also used Ibator to generate almost all of the queries -
 which saved us a huge amount of startup time.

 So in my humble opinion, iBATIS 3 is good to go!

 Jeff Butler

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 Guy Rouillier


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBator HierarchicalJava5Test fails on test testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs

2010-04-20 Thread Jeff Butler
I ran the tests just this morning and didn't have any failures.

Perhaps a bit more detail?

Jeff Butler


On Tue, Apr 20, 2010 at 3:26 PM, Elmer Smith esm...@venterraliving.com wrote:
 I am trying to build the latest version of iBator.  I re-sync with SVN and
 run “mvn clean install” but I get 1 failing test in  HierarchicalJava5Test
 fails on test testPKFieldsBlobsUpdateByPrimaryKeyWithBLOBs.



 The test looks Kosher so I don’t know why it would fail.  Anyone else have
 this problem or can help with it?



 Thanks,

 Elmer Smith

 This message (including any attachments) is intended only for the use of the
 individual or entity to whom it is addressed and may contain information
 that is non-public, proprietary, privileged, confidential, and exempt from
 disclosure under applicable law or may constitute attorney work product. If
 you are not the intended recipient, you are hereby notified that any use,
 dissemination, distribution, or copying of this communication is strictly
 prohibited. If you have received this communication in error, please notify
 us immediately by telephone and (i) destroy this message if a facsimile or
 (ii) delete this message immediately if an electronic communication.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: IBator mapper calls all getters, not just the ones it needs

2010-04-20 Thread Jeff Butler
Its a bug in ibatis - not ibator. It was fixed a couple of days ago.
Recompile ibatis and you'll be good to go.

Jeff Butler


On 4/20/10, Morearty, Brian brian_morea...@intuit.com wrote:
 Hi,



 I'm using iBATIS 3 with a IBator 1.2.2.



 I used IBator to generate my models in Eclipse. Then I added some more
 functions to the code-generated classes, taking advantage of the nifty
 feature where it doesn't clobber my changes.



 I've just discovered that when I call insertSelective(), it seems that
 all public getters in my model are called-regardless of whether they're
 needed for the insert. This is bad since some of the getters do
 lazy-evaluation and may slow things down.



 Is this by design, or perhaps (fingers-crossed) a known bug that has
 been fixed since I compiled IBator 1.2.2 a month and a half ago?



 I found the culprit in DynamicContext.java. It calls all the getters,
 regardless of whether they will be needed:



   public DynamicContext(Configuration configuration, Object
 parameterObject) {

 if (parameterObject != null  !(parameterObject instanceof Map)) {

   MetaObject metaObject =
 configuration.newMetaObject(parameterObject);

   String[] names = metaObject.getGetterNames();

   for (String name : names) {

 bindings.put(name, metaObject.getValue(name));

   }

 }

 bindings.put(PARAMETER_OBJECT_KEY, parameterObject);

   }





 Any chance there's a quick fix for this?



 Thanks!



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852





-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Transaction management in iBATIS 3 inside an EJB (3.1) container

2010-04-18 Thread Jeff Butler
AFAIK, it's always been required to close the connection to return it
to the connection pool.  iBATIS2's EXTERNAL transaction manager does
close the connection.  How else would the container know when we're
finished with the connection?

The problem I remember was with WebSphere when we didn't call commit()
before closing the connection with the JNDI transaction manager - that
caused a problem with WebSphere connection pooling and we had to
introduce the commitRequired property.

I did a quick look for EJB 3.1 and this:

http://java.sun.com/javaee/6/docs/tutorial/doc/bncjj.html

It seems to imply that we still have to call close to return the
connection to the pool.

Jeff Butler


On Sun, Apr 18, 2010 at 4:45 PM, Clinton Begin clinton.be...@gmail.com wrote:
 You did the right thing... iBATIS transaction managers are meant to be easy
 to implement yourself.

 That said, this was a matter of constant debate back in the good old days
 when none of the standards were implemented consistently.  I'm still not
 sure if they are.

 Some app servers would complain if iBATIS closed the connection, because if
 some downstream process needed a connection, theoretically it was supposed
 to use the same one (which would be closed by that time). I think the trick
 is to ensure that you're using a container managed DataSource.  Are you
 retrieving a DataSource configured by GlassFish from a JNDI context (in
 other words, a container manged DataSource)?  Or are you just using the
 iBATIS built-in SimpleDataSource?

 I would expect a container managed DataSource to lazily initialize a
 connection for any one worker thread, and continue to provide that same
 connection to any requester for that particular DataSource.  Then I'd expect
 it to close that connection at the end of the entire workflow.

 Does anyone know if the spec specifies this?

 Cheers,
 Clinton

 On Sun, Apr 18, 2010 at 2:31 PM, Adinath adin...@acciente.com wrote:

 Is anybody out there using iBATIS 3 as their persistence framework inside
 an EJB container? I recently started building a new system for which I
 choose EJB 3.1 (the version of EJB is actually irrelevant to this question)
 as my app framework and iBATIS 3 (this version is relevant!) as my
 persistence framework. My business logic is implemented in EJB 3.1 session
 beans that use iBATIS 3 for data access. I am running on GlassFish v3)

 My issue with this stack has been transaction management. I have solved my
 problem by writing some simple integration code, but I was little surprised
 I had to do this. So I decided to post this to see if others have run into
 this and if so how they solved the problem.

 My requirement is for iBATIS 3 to transparently use the EJB transaction
 (typically defined declaratively) in the session bean method. iBATIS 3
 provides 2 transaction factories JdbcTransactionFactory and
 ManagedTransactionFactory and I found that neither one works correctly in an
 EJB environment (and looking at the iBATIS source it is clear why it fails).

 The JdbcTransactionFactory is inappropriate since I want any calls to
 sqlSession.commit() or sqlSession.rollback() to be ignored. So I thought ok
 I should use the ManagedTransactionFactory since it does cause any calls to
 sqlSession.commit() or sqlSession.rollback() to be ignored, however it also
 causes sqlSession.close() to not close the connection that iBATIS opened
 from the DataSource in sqlSession.open() (the DataSource is a container
 managed DataSource object I provide to iBATIS). This causes the GlassFish to
 exhaust its connect pool and the application fails.

 So I wrote a new TransactionFactory implementation, EJBTransactionFactory,
 that causes sqlSession.commit() or sqlSession.rollback() to do nothing, but
 does close the connection when sqlSession.close() is called.

 I suspect other people have run into this, how did you solve it?

 Thanks,
 Adi

 --
 Acciente, LLC
 Systems Architecture and Software Design

 www.acciente.com
 www.inductionframework.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Locks

2010-04-14 Thread Jeff Butler
It's dependent on the transaction isolation level set on your
connection.  There are many variables involved - what is your
environment (POOLED, UNPOOLED, JNDI, etc.)?

Jeff Butler


On Wed, Apr 14, 2010 at 9:38 AM, Ejaz X Mohammed
ejaz.moham...@jpmorgan.com wrote:
 Hello,



 I have an application running on Sybase. DBAs tell me that it is generating
 too many locks … I know that all I'm doing is SELECT.



 I'm not sure how SELECT can create locks in database.



 Any suggestions ?



 Thanks

 Ejaz

 This email is confidential and subject to important disclaimers and
 conditions including on offers for the purchase or sale of securities,
 accuracy and completeness of information, viruses, confidentiality, legal
 privilege, and legal entity disclaimers, available at
 http://www.jpmorgan.com/pages/disclosures/email.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: DefaultSqlSession.selectOne()

2010-04-14 Thread Jeff Butler
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Contribute+Documentation

Jeff Butler

On Wed, Apr 14, 2010 at 10:15 AM, cowwoc cow...@bbs.darktech.org wrote:

    I don't mind using the workaround you outlined so long as it's mentioned
 in the iBatis 3 documentation. Right now it doesn't mention anything about
 the behavior of selectOne() or @Select returning a single value.

 Gili

 On 13/04/2010 8:59 PM, Clinton Begin wrote:

 The definition of null is the absence of value and meaning.  So
 regardless of whether it's a null column or no rows, no meaning should
 be applied to it.  Thus these cases are the same.

 If you want meaning to come from the row, return a value, perhaps the
 row number.

 Clinton

 On 2010-04-13, cowwoccow...@bbs.darktech.org  wrote:


 Hi,

      I hope I'm not reopening a hornet's nest but I just noticed the
 following comment in the code:

 // Popular vote was to return null on 0 results and throw exception on
 too many.

      How do you differentiate between selectOne() returning null because
 it found no rows versus it finding a single row containing a null value?
 I remember Sun's Engineers had the same debate for auto-boxing (should a
 null Integer get unboxed as 0 or throw an exception?) and they settled
 on exceptions precisely because of this ambiguity. Was there a huge vote
 in favor of returning null for zero results or are you still open to
 some hand twisting? :)

 Gili

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org







 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Locks

2010-04-14 Thread Jeff Butler
I assume you're using SIMPLE datasource.  With that data source, the
isolation level is set as a driver default.  I just did a quick test
with HSQLDB and the default seems to be TRANSACTION_READ_COMMITTED - a
middle of the road isolation level.  Maybe there is some setting on
the Sybase driver that will allow you to change the default isolation
level?

Alternatively, you can do it in code like this:

try {
  sqlMapClient.startTransaction(Connection.TRANSACTION_READ_UNCOMMITTED);

  -- do some work
} finally {
  sqlMapClient.endTransaction();
}

If you are using some other datasource (like JNDI), then you'll need
to look to that datasource for information about changing the
isolation level.

Jeff Butler





On Wed, Apr 14, 2010 at 9:51 AM, Ejaz X Mohammed
ejaz.moham...@jpmorgan.com wrote:
 These are my settings ...

    !--
    These settings control SqlMap configuration details, primarily to do with 
 transaction
    management. They are all optional (see the Developer Guide for more).
    --
    settings
            cacheModelsEnabled=true
            enhancementEnabled=true
            lazyLoadingEnabled=true
            maxRequests=32
            maxSessions=10
            maxTransactions=5
            useStatementNamespaces=true
        /

    !--
    Configure a datasource to use with this SQL Map using SimpleDataSource.
    Notice the use of the properties from the above resource
    --
    transactionManager type=JDBC 
        dataSource type=
            property name=JDBC.Driver value=${jdbc.driver}/
            property name=JDBC.ConnectionURL value=${jdbc.url}/
            property name=JDBC.Username value=${jdbc.user}/
            property name=JDBC.Password value=${jdbc.password}/
            property name=JDBC.DefaultAutoCommit value=true/
        /dataSource
    /transactionManager




 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Wednesday, April 14, 2010 9:44 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Locks

 It's dependent on the transaction isolation level set on your
 connection.  There are many variables involved - what is your
 environment (POOLED, UNPOOLED, JNDI, etc.)?

 Jeff Butler


 On Wed, Apr 14, 2010 at 9:38 AM, Ejaz X Mohammed
 ejaz.moham...@jpmorgan.com wrote:
 Hello,



 I have an application running on Sybase. DBAs tell me that it is generating
 too many locks ... I know that all I'm doing is SELECT.



 I'm not sure how SELECT can create locks in database.



 Any suggestions ?



 Thanks

 Ejaz

 This email is confidential and subject to important disclaimers and
 conditions including on offers for the purchase or sale of securities,
 accuracy and completeness of information, viruses, confidentiality, legal
 privilege, and legal entity disclaimers, available at
 http://www.jpmorgan.com/pages/disclosures/email.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org
 pspan STYLE=color :#00;background-color :#FF
 This email is confidential and subject to important disclaimers and 
 conditions including on offers for the purchase or sale of securities, 
 accuracy and completeness of information, viruses, confidentiality, legal 
 privilege, and legal entity disclaimers, available at 
 http://www.jpmorgan.com/pages/disclosures/email.
 /span/p

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Locks

2010-04-14 Thread Jeff Butler
iBATIS always starts a transaction.  If you want to avoid transactions
completely, you will need to implement your own version of a
transaction manager - you can base it on the EXTERNAL transaction
manager.

Jeff Butler


On Wed, Apr 14, 2010 at 11:43 AM, Ejaz X Mohammed
ejaz.moham...@jpmorgan.com wrote:
 I changed the code to use plain jdbc instead of ibatis ... as I said I'm 
 doing just SELECT ... I started no tranasaction .. now I don't see any locks, 
 perf seems to be better too ...

 If we start a transaction, sybase takes locks ... read lock for SELECT ...

 Can we avoid starting TX during select in ibatis?

 Ejaz


 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Wednesday, April 14, 2010 11:36 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Locks

 I assume you're using SIMPLE datasource.  With that data source, the
 isolation level is set as a driver default.  I just did a quick test
 with HSQLDB and the default seems to be TRANSACTION_READ_COMMITTED - a
 middle of the road isolation level.  Maybe there is some setting on
 the Sybase driver that will allow you to change the default isolation
 level?

 Alternatively, you can do it in code like this:

 try {
  sqlMapClient.startTransaction(Connection.TRANSACTION_READ_UNCOMMITTED);

  -- do some work
 } finally {
  sqlMapClient.endTransaction();
 }

 If you are using some other datasource (like JNDI), then you'll need
 to look to that datasource for information about changing the
 isolation level.

 Jeff Butler





 On Wed, Apr 14, 2010 at 9:51 AM, Ejaz X Mohammed
 ejaz.moham...@jpmorgan.com wrote:
 These are my settings ...

    !--
    These settings control SqlMap configuration details, primarily to do with 
 transaction
    management. They are all optional (see the Developer Guide for more).
    --
    settings
            cacheModelsEnabled=true
            enhancementEnabled=true
            lazyLoadingEnabled=true
            maxRequests=32
            maxSessions=10
            maxTransactions=5
            useStatementNamespaces=true
        /

    !--
    Configure a datasource to use with this SQL Map using SimpleDataSource.
    Notice the use of the properties from the above resource
    --
    transactionManager type=JDBC 
        dataSource type=
            property name=JDBC.Driver value=${jdbc.driver}/
            property name=JDBC.ConnectionURL value=${jdbc.url}/
            property name=JDBC.Username value=${jdbc.user}/
            property name=JDBC.Password value=${jdbc.password}/
            property name=JDBC.DefaultAutoCommit value=true/
        /dataSource
    /transactionManager




 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Wednesday, April 14, 2010 9:44 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Locks

 It's dependent on the transaction isolation level set on your
 connection.  There are many variables involved - what is your
 environment (POOLED, UNPOOLED, JNDI, etc.)?

 Jeff Butler


 On Wed, Apr 14, 2010 at 9:38 AM, Ejaz X Mohammed
 ejaz.moham...@jpmorgan.com wrote:
 Hello,



 I have an application running on Sybase. DBAs tell me that it is generating
 too many locks ... I know that all I'm doing is SELECT.



 I'm not sure how SELECT can create locks in database.



 Any suggestions ?



 Thanks

 Ejaz

 This email is confidential and subject to important disclaimers and
 conditions including on offers for the purchase or sale of securities,
 accuracy and completeness of information, viruses, confidentiality, legal
 privilege, and legal entity disclaimers, available at
 http://www.jpmorgan.com/pages/disclosures/email.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org
 pspan STYLE=color :#00;background-color :#FF
 This email is confidential and subject to important disclaimers and 
 conditions including on offers for the purchase or sale of securities, 
 accuracy and completeness of information, viruses, confidentiality, legal 
 privilege, and legal entity disclaimers, available at 
 http://www.jpmorgan.com/pages/disclosures/email.
 /span/p

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org

 This email is confidential and subject to important disclaimers and
 conditions including on offers for the purchase or sale of
 securities, accuracy and completeness of information, viruses,
 confidentiality, legal privilege, and legal entity disclaimers,
 available at http://www.jpmorgan.com/pages/disclosures/email

Re: Handling stale data on End User

2010-04-14 Thread Jeff Butler
There's nothing automatic in iBATIS to deal with this.

I suggest you do some research on optimistic locking - this is the
most common pattern for dealing with concurrency issues in the web
world.  iBATIS supports an optimistic locking strategy, but you have
to implement the SQL yourself - and design your tables properly.

Or - you can just let user B overwrite user A's changes.  In reality,
this is probably the most common pattern :)

Jeff Butler


On Wed, Apr 14, 2010 at 10:24 AM, Vinaya Tirikkovalluru
vinaya.tirikkovall...@converge.com wrote:
 Hi,

 I have a situation below..

 User A and User B queried the data for a part and are in edit mode.
 User A updates the part successfully. As user B is still in the screen,
 he does not know about the update. Now user B updates. Is there a way to
 show the user that the data is already stale to User B in Ibatis/Spring
 which makes it easier?

 Thanks
 Vinaya


 This electronic message is intended only for the use of the individual(s) or 
 entity(ies) named above and may contain information which is privileged 
 and/or confidential.  If you are not the intended recipient, be aware that 
 any disclosure, copying, distribution, dissemination or use of the contents 
 of this message is prohibited.  If you received this message in error, please 
 notify the sender immediately.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibatis 3 - special method in model class which Ibatis can't use

2010-04-13 Thread Jeff Butler
I just confirmed this to be true.  It has nothing to do with Ibator.

Clinton - the constructor for DynamicContext calls every getter in
the parameter object regardless of whether it is used in the query or
not.I suppose we should take a look at changing this somehow.

Jeff Butler


2010/4/13 Tomáš Procházka t.procha...@centrum.cz:

 Hi.


 Simply add method like

 private String something;

 public String getSomething() {
  System.out.println(Call getSomething);
  return something;
 }

 to some model class which was generated by IBATOR without any modification of 
 mapping xml.

 And try do some update or inserts with this model class like

 QueueMapper qm = s.getMapper(QueueMapper.class);
 qm.updateByPrimaryKeySelective(q);

 __
 Od: Clinton Begin clinton.be...@gmail.com
 Komu: user-java@ibatis.apache.org, Tomáš Procházka t.procha...@centrum.cz
 Datum: 12.04.2010 17:18
 Předmět: Re: Ibatis 3 - special method in model class which Ibatis can't use

Example?

2010/4/12 Tomáš Procházka t.procha...@centrum.cz

 Hi.

 I found some problem. I need have special method in model class which do
 some lazy initialization which can't be called from iBatis mapper. But
 problem is, that iBatis call all getXyz methods during insert or updated,
 also if I don't specify this fields in mapper xml file. I think that he call
 all get methods.

 Don't be better call only methods which is used in mapper XML file?

 Or exist some annotation which tell Ibatis don't use some method?

 I also tried move these methods to parent abstract class. So it is not
 defined in model class directly, but Ibatis still call them during insert or
 update.

 Do you somebody have some idea?


 Datum: 8:00:11    12. dubna 2010
 --
 -
  Tomáš Procházka


  E-mail: t.procha...@centrum.cz
    WWW: http://www.atomsoft.cz
    ICQ: 87147320
 -


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibatis 3 - special method in model class which Ibatis can't use

2010-04-13 Thread Jeff Butler
I've got a fix for this - I'll commit shortly.

Jeff Butler


On Tue, Apr 13, 2010 at 3:34 PM, Jeff Butler jeffgbut...@gmail.com wrote:
 I just confirmed this to be true.  It has nothing to do with Ibator.

 Clinton - the constructor for DynamicContext calls every getter in
 the parameter object regardless of whether it is used in the query or
 not.    I suppose we should take a look at changing this somehow.

 Jeff Butler


 2010/4/13 Tomáš Procházka t.procha...@centrum.cz:

 Hi.


 Simply add method like

 private String something;

 public String getSomething() {
  System.out.println(Call getSomething);
  return something;
 }

 to some model class which was generated by IBATOR without any modification 
 of mapping xml.

 And try do some update or inserts with this model class like

 QueueMapper qm = s.getMapper(QueueMapper.class);
 qm.updateByPrimaryKeySelective(q);

 __
 Od: Clinton Begin clinton.be...@gmail.com
 Komu: user-java@ibatis.apache.org, Tomáš Procházka t.procha...@centrum.cz
 Datum: 12.04.2010 17:18
 Předmět: Re: Ibatis 3 - special method in model class which Ibatis can't use

Example?

2010/4/12 Tomáš Procházka t.procha...@centrum.cz

 Hi.

 I found some problem. I need have special method in model class which do
 some lazy initialization which can't be called from iBatis mapper. But
 problem is, that iBatis call all getXyz methods during insert or updated,
 also if I don't specify this fields in mapper xml file. I think that he 
 call
 all get methods.

 Don't be better call only methods which is used in mapper XML file?

 Or exist some annotation which tell Ibatis don't use some method?

 I also tried move these methods to parent abstract class. So it is not
 defined in model class directly, but Ibatis still call them during insert 
 or
 update.

 Do you somebody have some idea?


 Datum: 8:00:11    12. dubna 2010
 --
 -
  Tomáš Procházka


  E-mail: t.procha...@centrum.cz
    WWW: http://www.atomsoft.cz
    ICQ: 87147320
 -


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibatis 3 - special method in model class which Ibatis can't use

2010-04-13 Thread Jeff Butler
Fixed.

https://issues.apache.org/jira/browse/IBATIS-777

Jeff Butler

On Tue, Apr 13, 2010 at 4:04 PM, Jeff Butler jeffgbut...@gmail.com wrote:
 I've got a fix for this - I'll commit shortly.

 Jeff Butler


 On Tue, Apr 13, 2010 at 3:34 PM, Jeff Butler jeffgbut...@gmail.com wrote:
 I just confirmed this to be true.  It has nothing to do with Ibator.

 Clinton - the constructor for DynamicContext calls every getter in
 the parameter object regardless of whether it is used in the query or
 not.    I suppose we should take a look at changing this somehow.

 Jeff Butler


 2010/4/13 Tomáš Procházka t.procha...@centrum.cz:

 Hi.


 Simply add method like

 private String something;

 public String getSomething() {
  System.out.println(Call getSomething);
  return something;
 }

 to some model class which was generated by IBATOR without any modification 
 of mapping xml.

 And try do some update or inserts with this model class like

 QueueMapper qm = s.getMapper(QueueMapper.class);
 qm.updateByPrimaryKeySelective(q);

 __
 Od: Clinton Begin clinton.be...@gmail.com
 Komu: user-java@ibatis.apache.org, Tomáš Procházka t.procha...@centrum.cz
 Datum: 12.04.2010 17:18
 Předmět: Re: Ibatis 3 - special method in model class which Ibatis can't 
 use

Example?

2010/4/12 Tomáš Procházka t.procha...@centrum.cz

 Hi.

 I found some problem. I need have special method in model class which do
 some lazy initialization which can't be called from iBatis mapper. But
 problem is, that iBatis call all getXyz methods during insert or updated,
 also if I don't specify this fields in mapper xml file. I think that he 
 call
 all get methods.

 Don't be better call only methods which is used in mapper XML file?

 Or exist some annotation which tell Ibatis don't use some method?

 I also tried move these methods to parent abstract class. So it is not
 defined in model class directly, but Ibatis still call them during insert 
 or
 update.

 Do you somebody have some idea?


 Datum: 8:00:11    12. dubna 2010
 --
 -
  Tomáš Procházka


  E-mail: t.procha...@centrum.cz
    WWW: http://www.atomsoft.cz
    ICQ: 87147320
 -


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator with rootclass overrides getters and setters

2010-04-09 Thread Jeff Butler
Ahhh...makes sense now.  With Ant classpath management is explicit.
With the popup menu its not so simple.  Once the popup menu is run the
Ibator plugin is in memory and stays there until Eclipse is closed.

This is part of the reason why I really dislike the popup menu item
for Ibator - classpath management in that case is far less than
optimal.  This might finally prompt me to make a change in this area.

Jeff Butler

On Fri, Apr 9, 2010 at 4:09 AM, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Ok, it works now.

 When I run the ant script (task ibator.generate) I've got no warnings, but
 attributs and methods are overidden.
 So, i tried to use the eclipse plugin and started the 'Generate ibatis
 artifacts', and I had a popup
 explaining that the rootclass could not be found.
 So, I had the classpathentry tag... and .. magic, it works !

 I think there's a confusion with the ant script classpath, and the classpath
 used by ibator...

 Thx very much for helping me.

 Jeremy



 Jeremy Jardin wrote:

 Well... I noticed something.
 If I restart Eclipse and run the script, I've got the warning about the
 rootClass not found.
 But, when I run it again, it seems to work.
 (it seem, because no warnings, but unfortunately, it doesn't work ;)

 So, I wonder if ibator really find the rootClass. I tried to add the
 classpathEntry, but
 where in the xml fie should I set it ? I saw that tag existed in abator,
 but not in ibator ? am I wrong ?


 Jeff Butler-2 wrote:

 It shouldn't make any difference - just using Java introspection to
 look for getter/setter methods.

 Jeff Butler


 On 4/8/10, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Ho, I thought about something.. is the order of the attributs in the
 rootClass important ?
 And what about comments ?


 Jeff Butler-2 wrote:

 It is a mystery :). There are unit tests in the Ibator build that test
 this functionality and they are passing.  If you're up for an
 experiment, try it with a build of Ibator from source - maybe
 something is wrong in the version you are using.

 Jeff Butler


 On 4/8/10, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 So, I'll try to be more explicit :)

 The DecObject class is just a bean, with a lot of attributs. (more
 than
 30..)
 For instance, 3 of its :
 private BigDecimal refCorinthe;
 private String siren;
 private String ndec

 public BigDecimal getRefCorinthe() {
           return refCorinthe;
   }
 public void setRefCorinthe(BigDecimal refCorinthe) {
           this.refCorinthe = refCorinthe;
   }
 public String getSiren() {
           return siren;
   }
 public void setSiren(String siren) {
   this.siren = siren == null ? null : siren.trim();
         }
 public String getNdec() {
           return ndec;
   }
 public void setNdec(String ndec) {
           this.ndec = ndec == null ? null : ndec.trim();
   }


 And, in the bean generated, I found that : (copy paste it, and removed
 javadoc comments)

     /**
      * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column  HISTORY_DEC.REF_CORINTHE
      * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
      */
     private BigDecimal refCorinthe;
     /**
      * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.SIREN
      * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
      */
     private String siren;

     /**
      * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.NDEC
      * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
      */
 private String ndec;

 public String getNdec() {
   return ndec;
     }
     public void setNdec(String ndec) {
   this.ndec = ndec == null ? null : ndec.trim();
     }
  public String getSiren() {
   return siren;
     }
     public void setSiren(String siren) {
   this.siren = siren == null ? null : siren.trim();
     }
  public BigDecimal getRefCorinthe() {
   return refCorinthe;
     }
     public void setRefCorinthe(BigDecimal refCorinthe) {
   this.refCorinthe = refCorinthe;
     }

 So, we can see that the attributs are matching..




 Jeff Butler-2 wrote:

 OK.  Then I need to see some detail. What are the methods in the base
 class, and what is Ibator generating?

 Jeff Butler


 On Thu, Apr 8, 2010 at 9:20 AM, Jeremy Jardin
 jeremy.jar...@gmail.com
 wrote:

 Yes, I had that message the first time I ran the ant script.

 Then, I tried something with the classPathEntry tag, but it seems
 to be working with Abator, and not with Ibator ?

 So, I had the jar containing the DecObject.class file in the
 classpath of my ant script..  and no more warnings !
 But, Ibator still overrides attributs and methods..



 Jeff Butler-2 wrote:

 Did you see a warning like this during your Ibator run:

 Root class com.DecObject cannot be loaded, checking for member
 overrides is disabled for this class

 If so, it means that DecObject is not in the class path and Ibator
 cannot check

Re: ibator with rootclass overrides getters and setters

2010-04-08 Thread Jeff Butler
Did you see a warning like this during your Ibator run:

Root class com.DecObject cannot be loaded, checking for member
overrides is disabled for this class

If so, it means that DecObject is not in the class path and Ibator
cannot check for overridden  methods.  Make sure that the compiled
DecObject class is in Ibator's classpath, or add a classPathEntry
configuration element specifying where the compiled class is.

Jeff Butler



On Thu, Apr 8, 2010 at 7:21 AM, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Hi,

 I'd like Ibator to generate ibatis bean extending a specific rootClass.
 3 of my tables are nearly the same.
 So I did something like that in the ibator-conf.xml file :

 ibatorContext
        table tableName=HISTORY_DEC domainObjectName=HistoryDec
           property name=rootClass value=com.DecObject /
        /table
 /ibatorContext

 The class DecObject is correctly found, and contains attributs which are the
 same
 that in the generated HistoryDec class.
 I checked that types and getter/setter were right, and it is.

 so, why ibator overrides attributs ?

 Thx,

 Jeremy
 --
 View this message in context: 
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28177744.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator with rootclass overrides getters and setters

2010-04-08 Thread Jeff Butler
OK.  Then I need to see some detail. What are the methods in the base
class, and what is Ibator generating?

Jeff Butler


On Thu, Apr 8, 2010 at 9:20 AM, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Yes, I had that message the first time I ran the ant script.

 Then, I tried something with the classPathEntry tag, but it seems
 to be working with Abator, and not with Ibator ?

 So, I had the jar containing the DecObject.class file in the
 classpath of my ant script..  and no more warnings !
 But, Ibator still overrides attributs and methods..



 Jeff Butler-2 wrote:

 Did you see a warning like this during your Ibator run:

 Root class com.DecObject cannot be loaded, checking for member
 overrides is disabled for this class

 If so, it means that DecObject is not in the class path and Ibator
 cannot check for overridden  methods.  Make sure that the compiled
 DecObject class is in Ibator's classpath, or add a classPathEntry
 configuration element specifying where the compiled class is.

 Jeff Butler



 On Thu, Apr 8, 2010 at 7:21 AM, Jeremy Jardin jeremy.jar...@gmail.com
 wrote:

 Hi,

 I'd like Ibator to generate ibatis bean extending a specific rootClass.
 3 of my tables are nearly the same.
 So I did something like that in the ibator-conf.xml file :

 ibatorContext
        table tableName=HISTORY_DEC domainObjectName=HistoryDec
           property name=rootClass value=com.DecObject /
        /table
 /ibatorContext

 The class DecObject is correctly found, and contains attributs which are
 the
 same
 that in the generated HistoryDec class.
 I checked that types and getter/setter were right, and it is.

 so, why ibator overrides attributs ?

 Thx,

 Jeremy
 --
 View this message in context:
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28177744.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 View this message in context: 
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28179286.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator with rootclass overrides getters and setters

2010-04-08 Thread Jeff Butler
It is a mystery :). There are unit tests in the Ibator build that test
this functionality and they are passing.  If you're up for an
experiment, try it with a build of Ibator from source - maybe
something is wrong in the version you are using.

Jeff Butler


On 4/8/10, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 So, I'll try to be more explicit :)

 The DecObject class is just a bean, with a lot of attributs. (more than
 30..)
 For instance, 3 of its :
 private BigDecimal refCorinthe;
 private String siren; 
 private String ndec

 public BigDecimal getRefCorinthe() {
   return refCorinthe;
   }
 public void setRefCorinthe(BigDecimal refCorinthe) {
   this.refCorinthe = refCorinthe;
   }
 public String getSiren() {
   return siren;
   }   
 public void setSiren(String siren) {
   this.siren = siren == null ? null : siren.trim();
 }
 public String getNdec() {
   return ndec;
   }
 public void setNdec(String ndec) {
   this.ndec = ndec == null ? null : ndec.trim();
   }


 And, in the bean generated, I found that : (copy paste it, and removed
 javadoc comments)

 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column  HISTORY_DEC.REF_CORINTHE
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private BigDecimal refCorinthe;
 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.SIREN
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private String siren;

 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.NDEC
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private String ndec;

 public String getNdec() {
   return ndec;
 }
 public void setNdec(String ndec) {
   this.ndec = ndec == null ? null : ndec.trim();
 }
  public String getSiren() {
   return siren;
 }
 public void setSiren(String siren) {
   this.siren = siren == null ? null : siren.trim();
 }
  public BigDecimal getRefCorinthe() {
   return refCorinthe;
 }
 public void setRefCorinthe(BigDecimal refCorinthe) {
   this.refCorinthe = refCorinthe;
 }

 So, we can see that the attributs are matching..




 Jeff Butler-2 wrote:

 OK.  Then I need to see some detail. What are the methods in the base
 class, and what is Ibator generating?

 Jeff Butler


 On Thu, Apr 8, 2010 at 9:20 AM, Jeremy Jardin jeremy.jar...@gmail.com
 wrote:

 Yes, I had that message the first time I ran the ant script.

 Then, I tried something with the classPathEntry tag, but it seems
 to be working with Abator, and not with Ibator ?

 So, I had the jar containing the DecObject.class file in the
 classpath of my ant script..  and no more warnings !
 But, Ibator still overrides attributs and methods..



 Jeff Butler-2 wrote:

 Did you see a warning like this during your Ibator run:

 Root class com.DecObject cannot be loaded, checking for member
 overrides is disabled for this class

 If so, it means that DecObject is not in the class path and Ibator
 cannot check for overridden  methods.  Make sure that the compiled
 DecObject class is in Ibator's classpath, or add a classPathEntry
 configuration element specifying where the compiled class is.

 Jeff Butler



 On Thu, Apr 8, 2010 at 7:21 AM, Jeremy Jardin jeremy.jar...@gmail.com
 wrote:

 Hi,

 I'd like Ibator to generate ibatis bean extending a specific rootClass.
 3 of my tables are nearly the same.
 So I did something like that in the ibator-conf.xml file :

 ibatorContext
        table tableName=HISTORY_DEC domainObjectName=HistoryDec
           property name=rootClass value=com.DecObject /
        /table
 /ibatorContext

 The class DecObject is correctly found, and contains attributs which
 are
 the
 same
 that in the generated HistoryDec class.
 I checked that types and getter/setter were right, and it is.

 so, why ibator overrides attributs ?

 Thx,

 Jeremy
 --
 View this message in context:
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28177744.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 View this message in context:
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28179286.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com

Re: ibator with rootclass overrides getters and setters

2010-04-08 Thread Jeff Butler
It shouldn't make any difference - just using Java introspection to
look for getter/setter methods.

Jeff Butler


On 4/8/10, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 Ho, I thought about something.. is the order of the attributs in the
 rootClass important ?
 And what about comments ?


 Jeff Butler-2 wrote:

 It is a mystery :). There are unit tests in the Ibator build that test
 this functionality and they are passing.  If you're up for an
 experiment, try it with a build of Ibator from source - maybe
 something is wrong in the version you are using.

 Jeff Butler


 On 4/8/10, Jeremy Jardin jeremy.jar...@gmail.com wrote:

 So, I'll try to be more explicit :)

 The DecObject class is just a bean, with a lot of attributs. (more than
 30..)
 For instance, 3 of its :
 private BigDecimal refCorinthe;
 private String siren;   
 private String ndec

 public BigDecimal getRefCorinthe() {
 return refCorinthe;
 }
 public void setRefCorinthe(BigDecimal refCorinthe) {
 this.refCorinthe = refCorinthe;
 }
 public String getSiren() {
 return siren;
 }   
 public void setSiren(String siren) {
 this.siren = siren == null ? null : siren.trim();
 }
 public String getNdec() {
 return ndec;
 }
 public void setNdec(String ndec) {
 this.ndec = ndec == null ? null : ndec.trim();
 }


 And, in the bean generated, I found that : (copy paste it, and removed
 javadoc comments)

 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column  HISTORY_DEC.REF_CORINTHE
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private BigDecimal refCorinthe;
 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.SIREN
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private String siren;

 /**
  * This field was generated by Apache iBATIS ibator. This field
 corresponds to the database column HISTORY_DEC.NDEC
  * @ibatorgenerated  Thu Apr 08 14:29:48 CEST 2010
  */
 private String ndec;

 public String getNdec() {
 return ndec;
 }
 public void setNdec(String ndec) {
 this.ndec = ndec == null ? null : ndec.trim();
 }
  public String getSiren() {
 return siren;
 }
 public void setSiren(String siren) {
 this.siren = siren == null ? null : siren.trim();
 }
  public BigDecimal getRefCorinthe() {
 return refCorinthe;
 }
 public void setRefCorinthe(BigDecimal refCorinthe) {
 this.refCorinthe = refCorinthe;
 }

 So, we can see that the attributs are matching..




 Jeff Butler-2 wrote:

 OK.  Then I need to see some detail. What are the methods in the base
 class, and what is Ibator generating?

 Jeff Butler


 On Thu, Apr 8, 2010 at 9:20 AM, Jeremy Jardin jeremy.jar...@gmail.com
 wrote:

 Yes, I had that message the first time I ran the ant script.

 Then, I tried something with the classPathEntry tag, but it seems
 to be working with Abator, and not with Ibator ?

 So, I had the jar containing the DecObject.class file in the
 classpath of my ant script..  and no more warnings !
 But, Ibator still overrides attributs and methods..



 Jeff Butler-2 wrote:

 Did you see a warning like this during your Ibator run:

 Root class com.DecObject cannot be loaded, checking for member
 overrides is disabled for this class

 If so, it means that DecObject is not in the class path and Ibator
 cannot check for overridden  methods.  Make sure that the compiled
 DecObject class is in Ibator's classpath, or add a classPathEntry
 configuration element specifying where the compiled class is.

 Jeff Butler



 On Thu, Apr 8, 2010 at 7:21 AM, Jeremy Jardin
 jeremy.jar...@gmail.com
 wrote:

 Hi,

 I'd like Ibator to generate ibatis bean extending a specific
 rootClass.
 3 of my tables are nearly the same.
 So I did something like that in the ibator-conf.xml file :

 ibatorContext
        table tableName=HISTORY_DEC domainObjectName=HistoryDec
           property name=rootClass value=com.DecObject /
        /table
 /ibatorContext

 The class DecObject is correctly found, and contains attributs which
 are
 the
 same
 that in the generated HistoryDec class.
 I checked that types and getter/setter were right, and it is.

 so, why ibator overrides attributs ?

 Thx,

 Jeremy
 --
 View this message in context:
 http://old.nabble.com/ibator-with-rootclass-overrides-getters-and-setters-tp28177744p28177744.html
 Sent from the iBATIS - User - Java mailing list archive at
 Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional

Re: Cannot resolve classpath entry

2010-04-05 Thread Jeff Butler
http://ibatis.apache.org/docs/tools/ibator/configreference/classPathEntry.html

Jeff Butler

On Mon, Apr 5, 2010 at 7:55 AM, magistermagica marais...@gmail.com wrote:

 Hi.

 I am testing Ibator in Eclipse and have come across the following problem:

 When I Right Click on the xml and instruct it to Generate iBATIS Artifacts
 I get the following error:

 Unexpected error while running Ibator.
 Cannot resolve classpath entry: mysql-connector-java-5.1.12-bin.jar

 How should the classpath enrty be formatted?


 --
 View this message in context: 
 http://old.nabble.com/Cannot-resolve-classpath-entry-tp28139736p28139736.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Configuring Ibator's classpath for different machines (Eclipse)

2010-03-31 Thread Jeff Butler
You could use the properties element to point to a common property
file, and then put the location of the JDBC driver in a property.
Still ugly.

The ibator menu option in eclipse is very limited - no control over
the classpath, no ability to specify properties, etc.  My suggestion
is that you remove the classPathEntry element altogether and run
Ibator with the integrated Ant task.  This will give you all the
flexibility you need - each team member can specify the location of
the driver on their Ant run configuration.

Look in the Eclipse documentation for Ibator - theres a sample
build.xml file you can copy that shows how to use the built in
ibator.generate task.

Jeff Butler


On Wed, Mar 31, 2010 at 3:27 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 My team is using Ibator 1.2.2 in Eclipse. We happen to have our Oracle
 installations in different directories. It looks like the classPathEntry
 element in Ibator config only allows an absolute path:



   classPathEntry
 location=C:/oraclexe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc6.jar/



 Is there a way to do parameter substitution in this file, either from a
 system environment variable, an Eclipse “linked resource,” or something
 else?



 If not we can work around it by requiring everyone to have this jar
 available in the same place.



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Configuring Ibator's classpath for different machines (Eclipse)

2010-03-31 Thread Jeff Butler
I think you misunderstood me.  There is an Ant task built into Eclipse
for Ibator.  It includes the don't clobber on regenerate
capabilities.  This is different than the regular ant task in the base
Ibator distribution.  Check it out!  It does exactly what you need.

Jeff Butler

On Wed, Mar 31, 2010 at 3:46 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 Thanks for the suggestion.  We like the Eclipse-Ibator feature that lets us 
 regenerate without clobbering custom code we've added to the model objects, 
 so I think Ant isn't an option for us.

 That's ok.  It's not too super-painful to make sure we all put one jar in a 
 consistent place.

 Brian



 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Wednesday, March 31, 2010 1:39 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Configuring Ibator's classpath for different machines (Eclipse)

 You could use the properties element to point to a common property
 file, and then put the location of the JDBC driver in a property.
 Still ugly.

 The ibator menu option in eclipse is very limited - no control over
 the classpath, no ability to specify properties, etc.  My suggestion
 is that you remove the classPathEntry element altogether and run
 Ibator with the integrated Ant task.  This will give you all the
 flexibility you need - each team member can specify the location of
 the driver on their Ant run configuration.

 Look in the Eclipse documentation for Ibator - theres a sample
 build.xml file you can copy that shows how to use the built in
 ibator.generate task.

 Jeff Butler


 On Wed, Mar 31, 2010 at 3:27 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 My team is using Ibator 1.2.2 in Eclipse. We happen to have our Oracle
 installations in different directories. It looks like the classPathEntry
 element in Ibator config only allows an absolute path:



   classPathEntry
 location=C:/oraclexe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc6.jar/



 Is there a way to do parameter substitution in this file, either from a
 system environment variable, an Eclipse linked resource, or something
 else?



 If not we can work around it by requiring everyone to have this jar
 available in the same place.



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Eclipse error when running Ibator

2010-03-26 Thread Jeff Butler
Two questions - one obvious, one not so obvious :)

1. (Obvious) What's different in the failing environment? (Different
Eclipse version?  Different JRE?  Different Eclipse distribution?
etc.)

2. (not so obvious) This looks to be failing in the code formatter.
I'd take a close look at the Java code formatting options on the
failing machine - what's different there?

Jeff Butler

On Thu, Mar 25, 2010 at 7:41 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 Hi,



 My team has 3 developers. One of us is having the following problem. The
 other two of us are not. Does anyone have ideas for how to fix this? We are
 using Ibator 1.2.2.



 Right-click on IbatorConfig.xml and choose “Generate iBATIS Artifacts.”
 Progress bar goes part-way, then shows this error:



 Severity: Error

 Message: Unexpected error while running Ibator.

 Exception Stack Trace:

 java.lang.ArrayIndexOutOfBoundsException: 247

     at
 org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:3239)

     at
 org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse(ConstructorDeclaration.java:497)

     at
 org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:542)

     at
 org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.formatClassBodyDeclarations(CodeFormatterVisitor.java:1528)

     at
 org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:772)

     at
 org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.internalFormatClassBodyDeclarations(DefaultCodeFormatter.java:452)

     at
 org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatClassBodyDeclarations(DefaultCodeFormatter.java:229)

     at
 org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:202)

     at
 org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:188)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatString(ASTRewriteFormatter.java:238)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatNode(ASTRewriteFormatter.java:363)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.getFormattedResult(ASTRewriteFormatter.java:179)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doTextInsert(ASTRewriteAnalyzer.java:1152)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:569)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteParagraphList(ASTRewriteAnalyzer.java:997)

     at
 org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1575)

     at
 org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:467)

     at
 org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)

     at
 org.eclipse.jdt.core.dom.rewrite.ASTRewrite.internalRewriteAST(ASTRewrite.java:271)

     at
 org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST(ASTRewrite.java:202)

     at
 org.apache.ibatis.ibator.eclipse.core.merge.JavaFileMerger.getMergedSource(Unknown
 Source)

     at
 org.apache.ibatis.ibator.eclipse.core.callback.EclipseShellCallback.mergeJavaFile(Unknown
 Source)

     at org.apache.ibatis.ibator.api.Ibator.generate(Unknown
 Source)

     at org.apache.ibatis.ibator.api.Ibator.generate(Unknown
 Source)

     at
 org.apache.ibatis.ibator.eclipse.ui.actions.RunIbatorThread.run(Unknown
 Source)

     at
 org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)

     at
 org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)

     at
 org.apache.ibatis.ibator.eclipse.ui.actions.RunIbatorAction$IbatorRunner.run(Unknown
 Source)

     at
 org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

 Session Data:

 eclipse.buildId=

 java.version=1.6.0_18

 java.vendor=Sun Microsystems Inc.

 BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US

 Framework arguments:  -product org.eclipse.epp.package.jee.product

 Command-line arguments:  -os win32 -ws win32 -arch x86 -product
 org.eclipse.epp.package.jee.product







 WORKAROUND: deleting the previously-generated “XyzExample.java” file before
 the code-gen eliminates this error. But it’s kind of annoying to have to do
 that.



 Since the stack mentions that Eclipse JDT is parsing a constructor we tried
 an experiment: delete all the constructors from XyzExample.java and then
 re-generate the artifacts. We still got the same error.





 Brian Morearty | Grow Your Business Division

Re: newbie Q: get back generated key with Oracle

2010-03-26 Thread Jeff Butler
Right!

On Fri, Mar 26, 2010 at 3:12 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 Thanks, Jeff.  And now I see the likely fix: when there's a generatedKey 
 type=pre/ in the Ibator config, Ibator should always include the ID in the 
 insert statement instead of conditionally including it.

 Brian


 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 26, 2010 1:01 PM
 To: user-java@ibatis.apache.org
 Subject: Re: newbie Q: get back generated key with Oracle

 This is an Ibator issue and it's an interesting case that I had not
 considered previously.  I'll fix it.

 Jeff Butler

 On Wed, Mar 24, 2010 at 5:33 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 Related to this discussion earlier today, I have a feature request.  I'm not 
 sure if this should be in iBATIS or Ibator.

 Problem: if I let Oracle autogenerate a primary key for me, like this:

  insert id=insertSelective 
 parameterType=com.intuit.websites.models.generated.Business
    selectKey keyProperty=id order=BEFORE 
 resultType=java.math.BigDecimal
      SELECT businesses_sequence.nextval FROM dual
    /selectKey
    insert into WEBSITE_USER.BUSINESSES
    trim prefix=( suffix=) suffixOverrides=,
      if test=id != null
        ID,
      /if
    

 then the Ibator-generated insertSelective statement fails with an error:

   ORA-01400: cannot insert NULL into (WEBSITE_USER.BUSINESSES.ID)

 Why? Because I didn't set the ID (I was planning to let it be generated) and 
 apparently the if test=id != null gets evaluated before the value gets 
 inserted into the ID.

 I do have a workaround: always insert a dummy ID of 0 before calling 
 insertSelective.  But it would be nice if I didn't have to.

 Not sure what the best solution is but it seems like it would be nice to fix.

 Brian



 -Original Message-
 From: Morearty, Brian [mailto:brian_morea...@intuit.com]
 Sent: Wednesday, March 24, 2010 11:18 AM
 To: user-java@ibatis.apache.org
 Subject: RE: newbie Q: get back generated key with Oracle

 Oh yeah, it does! Duh! Woo hoo.

 Thanks for the quick reply, Larry.


 -Original Message-
 From: Larry Meadors [mailto:larry.mead...@gmail.com]
 Sent: Wednesday, March 24, 2010 11:15 AM
 To: user-java@ibatis.apache.org
 Subject: Re: newbie Q: get back generated key with Oracle

 It should set the id property on the Business bean passed in as a parameter.

 Larry


 On Wed, Mar 24, 2010 at 12:11 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 Hi, here's a newbie question:



 I'm using iBATIS, Ibator, and Oracle. I have a businesses table. I also
 created a businesses_sequence sequence so I can autogenerate primary keys.
 (Apparently Oracle does it that way instead of allowing an autoincrement
 column.)



 How do I get back the primary key after an insert statement? (So I can, for
 example, add reference the thing I just inserted from other tables.)



 Originally I was using a before-insert trigger to select the next value from
 the sequence but I don't get the value back from the mapper's insert
 statement. I realized I probably had to use the 'generatedKey' statement so
 I tried this:



 table schema=website_user tableName=businesses
 domainObjectName=Business

   generatedKey column=id sqlStatement=SELECT
 businesses_sequence.nextval FROM dual type=pre/

 /table



 This generates the following mapping:



   insert id=insert
 parameterType=com.intuit.websites.models.generated.Business

     !--

   WARNING - @ibatorgenerated

   This element is automatically generated by Apache iBATIS Ibator, do
 not modify.

   This element was generated on Wed Mar 24 10:49:12 PDT 2010.

     --

     selectKey keyProperty=id order=BEFORE
 resultType=java.math.BigDecimal

   SELECT businesses_sequence.nextval FROM dual

     /selectKey

     insert into WEBSITE_USER.BUSINESSES (ID, NAME, PHONE,

   WEBSITE, CREATED_AT, UPDATED_AT

   )

     values (#{id,jdbcType=DECIMAL}, #{name,jdbcType=VARCHAR},
 #{phone,jdbcType=VARCHAR},

   #{website,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
 #{updatedAt,jdbcType=TIMESTAMP}

   )

   /insert



 It successfully selects from the sequence but it does not return the
 inserted id to me, porbably because the last statement is an insert, not a
 select.



 What else should I try? Or am I thinking about this the wrong way?



 P.S. This is Oracle 10g Express Edition with ojdbc14.jar. Supposedly it
 supports the JDBC getGeneratedKey() function-I'm not sure if iBATIS under
 the hood calls that function.





 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org


 -
 To unsubscribe, e

Re: mapping insert of object graph

2010-03-18 Thread Jeff Butler
Basically it's manual because SQL doesn't have a concept like join on
insert.  So you usually write a dao or service method like this:

insertMasterRecord();
for each detail record {
  insertDetailRecord();
}
commit();

Jeff Butler


On Thu, Mar 18, 2010 at 8:05 AM, Jon Finanger j...@finanger.no wrote:
 Any way to map insertion of an object graph ?
 Or is manually insertion the only way

 -Jon


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator 1.2.2 Eclipse jars not published

2010-03-12 Thread Jeff Butler
The SVN repo has moved - glad you found the new one!  The how to
build pages in SVN should be current - it sounds like you found the
page for building the Eclipse feature.

Ibator for Eclipse now builds with the headless PDE build process so a
simple Export doesn't work anymore.  When you run the PDE build, the
resulting file is placed on your hard drive in the
\Temp\ibator.build\I.TestBuild directory.  You can unzip that file
directly into an eclipse install and it should work fine.

Jeff Butler


On Fri, Mar 12, 2010 at 12:24 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 Hi,



 I am starting a new project with iBATIS 3 and Ibator. I am successfully
 using Ibator 1.2.2 from the command line but we’d like to use the Eclipse
 version of Ibator so we can add methods to the generated models and not have
 them clobbered.



 Can someone point me to instructions for either downloading or
 building+installing Ibator 1.2.2 for Eclipse? (Since that’s the version that
 supports iBATIS 3).



 Here’s what I’ve tried so far:

 · I pointed Eclipse to the plugin install site at
 http://ibatis.apache.org/tools/ibator/ but the newest version it has is
 1.2.1.

 · I went to the manual download site at
 http://people.apache.org/builds/ibatis/ibator/ but the newest version it has
 is 1.2.1.

 · I tried the instructions at
 http://ibatis.apache.org/docs/tools/ibator/reference/building.html but
 they’re out of date. The svn repo doesn’t exist. Once I found an svn repo,
 build.bat didn’t exist.

 · I downloaded the source from
 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk and followed the
 instructions in the local version of buildingFromSVN.html. I was able to
 build, but no JARs were created. I figured out I could right-click each
 project and choose “Export…” and choose type JAR, then copy those JARs to
 IbatorUpdateSite\plugins. But I could not find a way to export the “feature”
 jar that goes into IbatorUpdateSite\features.



 Any advice?



 Thanks!



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator 1.2.2 Eclipse jars not published

2010-03-12 Thread Jeff Butler
By the way - there's a problem with the Eclipse Java file merger right
now.  I added something new to base Ibator recently, and it broke the
eclipse merger.  That's what I get for eating my own dog food!  I keep
finding things I want to add to Ibator.

I'll try to fix it this afternoon.

Jeff Butler


On Fri, Mar 12, 2010 at 1:03 PM, Jeff Butler jeffgbut...@gmail.com wrote:
 The SVN repo has moved - glad you found the new one!  The how to
 build pages in SVN should be current - it sounds like you found the
 page for building the Eclipse feature.

 Ibator for Eclipse now builds with the headless PDE build process so a
 simple Export doesn't work anymore.  When you run the PDE build, the
 resulting file is placed on your hard drive in the
 \Temp\ibator.build\I.TestBuild directory.  You can unzip that file
 directly into an eclipse install and it should work fine.

 Jeff Butler


 On Fri, Mar 12, 2010 at 12:24 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 Hi,



 I am starting a new project with iBATIS 3 and Ibator. I am successfully
 using Ibator 1.2.2 from the command line but we’d like to use the Eclipse
 version of Ibator so we can add methods to the generated models and not have
 them clobbered.



 Can someone point me to instructions for either downloading or
 building+installing Ibator 1.2.2 for Eclipse? (Since that’s the version that
 supports iBATIS 3).



 Here’s what I’ve tried so far:

 · I pointed Eclipse to the plugin install site at
 http://ibatis.apache.org/tools/ibator/ but the newest version it has is
 1.2.1.

 · I went to the manual download site at
 http://people.apache.org/builds/ibatis/ibator/ but the newest version it has
 is 1.2.1.

 · I tried the instructions at
 http://ibatis.apache.org/docs/tools/ibator/reference/building.html but
 they’re out of date. The svn repo doesn’t exist. Once I found an svn repo,
 build.bat didn’t exist.

 · I downloaded the source from
 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk and followed the
 instructions in the local version of buildingFromSVN.html. I was able to
 build, but no JARs were created. I figured out I could right-click each
 project and choose “Export…” and choose type JAR, then copy those JARs to
 IbatorUpdateSite\plugins. But I could not find a way to export the “feature”
 jar that goes into IbatorUpdateSite\features.



 Any advice?



 Thanks!



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852




-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator 1.2.2 Eclipse jars not published

2010-03-12 Thread Jeff Butler
Run the build.xml file in the build project.

Jeff Butler


On 3/12/10, Morearty, Brian brian_morea...@intuit.com wrote:
 Hmm, I must have done something wrong.  As instructed on the build page I
 loaded the projects into Eclipse and waited for the build to complete.  But
 I don't have a \Temp\ibator.build\I.TestBuild directory.

 (When you wrote \Temp did you mean at the root of the drive?  I checked
 there, as well as under my Ibator source tree.)

 What is the name of the file I should be looking for to unzip?

 I do see an org.apache.ibatis.ibator.build project that wasn't mentioned
 in the build instructions.  This is the closest I have to an ibator.build
 folder.  But the only things in it are build.properties, build.xml,
 .project, and a .svn folder.

 There were some Plug-in Problems in the Eclipse Problems pane.  I don't
 know if these are relevant.

 Description
   Resource Path  Location
 Type
 Feature reference 'org.apache.ibatis.ibator.source' cannot be resolved
  feature.xml   /org.apache.ibatis.ibator line 25
 Plug-in Problem
 The folder html/ does not exist in the workspace
  build.properties  /org.apache.ibatis.ibator.eclipse.doc line 2
 Plug-in Problem

 I last updated the local svn repo on March 4th.

 Brian





 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 12, 2010 11:03 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Ibator 1.2.2 Eclipse jars not published

 The SVN repo has moved - glad you found the new one!  The how to
 build pages in SVN should be current - it sounds like you found the
 page for building the Eclipse feature.

 Ibator for Eclipse now builds with the headless PDE build process so a
 simple Export doesn't work anymore.  When you run the PDE build, the
 resulting file is placed on your hard drive in the
 \Temp\ibator.build\I.TestBuild directory.  You can unzip that file
 directly into an eclipse install and it should work fine.

 Jeff Butler


 On Fri, Mar 12, 2010 at 12:24 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 Hi,



 I am starting a new project with iBATIS 3 and Ibator. I am successfully
 using Ibator 1.2.2 from the command line but we'd like to use the Eclipse
 version of Ibator so we can add methods to the generated models and not
 have
 them clobbered.



 Can someone point me to instructions for either downloading or
 building+installing Ibator 1.2.2 for Eclipse? (Since that's the version
 that
 supports iBATIS 3).



 Here's what I've tried so far:

 · I pointed Eclipse to the plugin install site at
 http://ibatis.apache.org/tools/ibator/ but the newest version it has is
 1.2.1.

 · I went to the manual download site at
 http://people.apache.org/builds/ibatis/ibator/ but the newest version it
 has
 is 1.2.1.

 · I tried the instructions at
 http://ibatis.apache.org/docs/tools/ibator/reference/building.html but
 they're out of date. The svn repo doesn't exist. Once I found an svn repo,
 build.bat didn't exist.

 · I downloaded the source from
 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk and followed the
 instructions in the local version of buildingFromSVN.html. I was able to
 build, but no JARs were created. I figured out I could right-click each
 project and choose Export... and choose type JAR, then copy those JARs
 to
 IbatorUpdateSite\plugins. But I could not find a way to export the
 feature
 jar that goes into IbatorUpdateSite\features.



 Any advice?



 Thanks!



 Brian Morearty | Grow Your Business Division, Intuit | Staff Software
 Engineer | direct 650-944-6852



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator 1.2.2 Eclipse jars not published

2010-03-12 Thread Jeff Butler
I'm glad you got it working.  I'm working on making the documentation
for this better!

Jeff Butler


On Fri, Mar 12, 2010 at 8:57 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 I got it working.

 In case anyone else has this problem: I didn't know I had to update the 
 build.properties file to set some variables in there to match my local 
 machine configuration.

 I also had to update site.xml.  This is what I ended up with:

 ?xml version=1.0 encoding=UTF-8?
 site
   feature url=features/org.apache.ibatis.ibator_1.2.0.jar 
 id=org.apache.ibatis.ibator version=1.2.0
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator_1.2.1.jar 
 id=org.apache.ibatis.ibator version=1.2.1
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator_1.2.2.jar 
 id=org.apache.ibatis.ibator version=1.2.2
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator.source_1.2.2.jar 
 id=org.apache.ibatis.ibator.source version=1.2.2
      category name=Ibator Source Version 1.2/
   /feature
   category-def name=Ibator Version 1.2 label=Ibator Version 1.2
      description
         Versions of the Ibator featured based on Ibator version 1.2 and 
 Eclipse version 3.4.1
      /description
   /category-def
   category-def name=Ibator Source Version 1.2 label=Ibator Version 1.2
      description
         Versions of the Ibator Source featured based on Ibator version 1.2 
 and Eclipse version 3.4.1
      /description
   /category-def
 /site



 -Original Message-
 From: Morearty, Brian [mailto:brian_morea...@intuit.com]
 Sent: Friday, March 12, 2010 4:37 PM
 To: user-java@ibatis.apache.org
 Subject: RE: Ibator 1.2.2 Eclipse jars not published

 Cool, that helps.  Do you mean right-click build.xml in the build project and 
 choose Run As - Ant Build?

 When I do that I get a bunch of errors, even though the Eclipse syntax 
 highlighter doesn't show errors.  The errors indicate that the compiler can't 
 find Ant.  Things like:

 [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:20:
  package org.apache.tools.ant does not exist
  [javadoc] import org.apache.tools.ant.Project;
  [javadoc]                             ^
  [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:21:
  package org.apache.tools.ant does not exist
  [javadoc] import org.apache.tools.ant.Task;
  [javadoc]                             ^
  [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:31:
  cannot find symbol
  [javadoc] symbol  : class Task
  [javadoc] location: class org.apache.ibatis.ibator.ant.AntProgressCallback
  [javadoc]     private Task task;
  [javadoc]             ^

 And so forth.

 Brian



 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 12, 2010 12:35 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Ibator 1.2.2 Eclipse jars not published

 Run the build.xml file in the build project.

 Jeff Butler


 On 3/12/10, Morearty, Brian brian_morea...@intuit.com wrote:
 Hmm, I must have done something wrong.  As instructed on the build page I
 loaded the projects into Eclipse and waited for the build to complete.  But
 I don't have a \Temp\ibator.build\I.TestBuild directory.

 (When you wrote \Temp did you mean at the root of the drive?  I checked
 there, as well as under my Ibator source tree.)

 What is the name of the file I should be looking for to unzip?

 I do see an org.apache.ibatis.ibator.build project that wasn't mentioned
 in the build instructions.  This is the closest I have to an ibator.build
 folder.  But the only things in it are build.properties, build.xml,
 .project, and a .svn folder.

 There were some Plug-in Problems in the Eclipse Problems pane.  I don't
 know if these are relevant.

 Description
   Resource         Path                                      Location
 Type
 Feature reference 'org.apache.ibatis.ibator.source' cannot be resolved
  feature.xml       /org.apache.ibatis.ibator                 line 25
 Plug-in Problem
 The folder html/ does not exist in the workspace
  build.properties  /org.apache.ibatis.ibator.eclipse.doc     line 2
 Plug-in Problem

 I last updated the local svn repo on March 4th.

 Brian





 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 12, 2010 11:03 AM
 To: user-java@ibatis.apache.org
 Subject: Re: Ibator 1.2.2 Eclipse jars not published

 The SVN repo has moved - glad you found the new one!  The how to
 build pages in SVN should be current - it sounds like you found the
 page for building the Eclipse feature.

 Ibator for Eclipse now builds with the headless PDE build process so a
 simple Export doesn't work anymore.  When you run the PDE build, the
 resulting file is placed

Re: Ibator 1.2.2 Eclipse jars not published

2010-03-12 Thread Jeff Butler
iBATIS 3 does not need mapper implementations - iBATIS creates them
automagically!

SomeMapper mapper = sqlSession.getMapper(SomeMapper.class);

Jeff

On Fri, Mar 12, 2010 at 9:11 PM, Morearty, Brian
brian_morea...@intuit.com wrote:
 Thanks, Jeff.  The existing doc is pretty good, just needs a few extra things.

 Also since I'm not doing anything special with the source code, all I really 
 needed was to install it.  So even better than updating the documentation 
 would be an updated install site at
        http://ibatis.apache.org/tools/ibator
 that has the 1.2.2 version, for people who are using iBATIS 3.

 One thing that's not quite clear to me: it generates some Mapper interfaces 
 but no implementations.  Is that a bug or by design or am I doing something 
 wrong?

 Brian



 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 12, 2010 7:04 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Ibator 1.2.2 Eclipse jars not published

 I'm glad you got it working.  I'm working on making the documentation
 for this better!

 Jeff Butler


 On Fri, Mar 12, 2010 at 8:57 PM, Morearty, Brian
 brian_morea...@intuit.com wrote:
 I got it working.

 In case anyone else has this problem: I didn't know I had to update the 
 build.properties file to set some variables in there to match my local 
 machine configuration.

 I also had to update site.xml.  This is what I ended up with:

 ?xml version=1.0 encoding=UTF-8?
 site
   feature url=features/org.apache.ibatis.ibator_1.2.0.jar 
 id=org.apache.ibatis.ibator version=1.2.0
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator_1.2.1.jar 
 id=org.apache.ibatis.ibator version=1.2.1
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator_1.2.2.jar 
 id=org.apache.ibatis.ibator version=1.2.2
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator.source_1.2.2.jar 
 id=org.apache.ibatis.ibator.source version=1.2.2
      category name=Ibator Source Version 1.2/
   /feature
   category-def name=Ibator Version 1.2 label=Ibator Version 1.2
      description
         Versions of the Ibator featured based on Ibator version 1.2 and 
 Eclipse version 3.4.1
      /description
   /category-def
   category-def name=Ibator Source Version 1.2 label=Ibator Version 1.2
      description
         Versions of the Ibator Source featured based on Ibator version 1.2 
 and Eclipse version 3.4.1
      /description
   /category-def
 /site



 -Original Message-
 From: Morearty, Brian [mailto:brian_morea...@intuit.com]
 Sent: Friday, March 12, 2010 4:37 PM
 To: user-java@ibatis.apache.org
 Subject: RE: Ibator 1.2.2 Eclipse jars not published

 Cool, that helps.  Do you mean right-click build.xml in the build project 
 and choose Run As - Ant Build?

 When I do that I get a bunch of errors, even though the Eclipse syntax 
 highlighter doesn't show errors.  The errors indicate that the compiler 
 can't find Ant.  Things like:

 [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:20:
  package org.apache.tools.ant does not exist
  [javadoc] import org.apache.tools.ant.Project;
  [javadoc]                             ^
  [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:21:
  package org.apache.tools.ant does not exist
  [javadoc] import org.apache.tools.ant.Task;
  [javadoc]                             ^
  [javadoc] 
 C:\Code\ibator\core\ibator-core\src\main\java\org\apache\ibatis\ibator\ant\AntProgressCallback.java:31:
  cannot find symbol
  [javadoc] symbol  : class Task
  [javadoc] location: class org.apache.ibatis.ibator.ant.AntProgressCallback
  [javadoc]     private Task task;
  [javadoc]             ^

 And so forth.

 Brian



 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, March 12, 2010 12:35 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Ibator 1.2.2 Eclipse jars not published

 Run the build.xml file in the build project.

 Jeff Butler


 On 3/12/10, Morearty, Brian brian_morea...@intuit.com wrote:
 Hmm, I must have done something wrong.  As instructed on the build page I
 loaded the projects into Eclipse and waited for the build to complete.  But
 I don't have a \Temp\ibator.build\I.TestBuild directory.

 (When you wrote \Temp did you mean at the root of the drive?  I checked
 there, as well as under my Ibator source tree.)

 What is the name of the file I should be looking for to unzip?

 I do see an org.apache.ibatis.ibator.build project that wasn't mentioned
 in the build instructions.  This is the closest I have to an ibator.build
 folder.  But the only things in it are build.properties, build.xml,
 .project, and a .svn folder.

 There were some Plug-in Problems in the Eclipse Problems pane.  I don't
 know if these are relevant

Re: Ibator for ibatis 3

2010-02-21 Thread Jeff Butler
Hi Guy,

The Eclipse plugin build is undergoing lots of changes right now.
Thanks for the reminder about the MANIFEST.MF versions - I definitely
need to change those.

The includes section is there because I'm changing the build to use
a headless PDE build rather than using the site generate feature.
This will allow me to publish source bundles for the plugins -
something I've never done before.  You might notice that there is a
new build project in SVN - there's an Ant script there that builds
the plugin now.

I'll clean up site.xml once everything else is working.  They seem to
change the format of site.xml with every release of eclipse :)

As with all things eclipse, the platform is overwhelming and it's
taking me a long time to piece the build together from arcane bits of
information on WIKIs and blogs.  It's *almost* working now - I should
have it complete in another day or two.  Then maybe I can do a real
release next weekend.

Jeff




On Sun, Feb 21, 2010 at 10:15 PM, Guy Rouillier guyr-...@burntmail.com wrote:
 Jeff, I did a fresh checkout and build, and I'm now able to use the Ibator
 Eclipse feature.  Much thanks for making the needed changes.  I had to make
 some small changes to get everything to work:

 MANIFEST.MF for ui plug-in:

 Update the following two lines:

 org.apache.ibatis.ibator.eclipse.core;bundle-version=1.2.2,
 org.apache.ibatis.ibator.core;bundle-version=1.2.2,

 feature.xml:

 delete:
 includes
         id=org.apache.ibatis.ibator.source
         version=0.0.0/

 site.xml:

 delete:
 feature url=features/org.apache.ibatis.ibator_1.2.0.jar
 id=org.apache.ibatis.ibator version=1.2.0
      category name=Ibator Version 1.2/
   /feature
   feature url=features/org.apache.ibatis.ibator_1.2.1.jar
 id=org.apache.ibatis.ibator version=1.2.1
      category name=Ibator Version 1.2/
   /feature

 I generated an update site to share with co-workers.  If I didn't delete
 these, then when I added the Update Site, Eclipse showed me 3 entries for
 the Ibator feature, and the titles were the same for all, since the title
 comes from the category name.

 One other issue I noticed was that when I instructed Eclipse to remove this
 feature, it did not delete the JAR files.  That caused problems on the next
 install.  So what I ended up doing was to delete the feature, shut down
 Eclipse, manually delete the JAR files, restart Eclipse and reinstall the
 feature.


 On 2/19/2010 6:47 PM, Guy Rouillier wrote:

 I'll try a fresh checkout.  The link below is failing for me:

 The requested URL

 /repos/asf/ibatis/java/ibator/trunk/eclipse/org.apacheibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html
 was not found on this server.

 On 2/19/2010 4:07 PM, Jeff Butler wrote:

 I just committed some changes to the eclipse plugin code for version
 1.2.2. Things work fine for me. Also, I updated the instructions for
 building the eclipse plugin here:


 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apacheibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html


 Jeff Butler


 On Fri, Feb 19, 2010 at 12:31 PM, Guy
 Rouillierguyr-...@burntmail.com wrote:

 Unfortunately, that's not it. I had found that manifest and updated
 it to
 reflect 3.0.0. I'll try working more on this tonight. I'll search my
 Eclipse installation and just remove all other instances of the
 Ibator JAR;
 hopefully then at least Eclipse will give me some big error message
 identifying where it is picking up the older version. Thanks.

 
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Ibator Core Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.core
 Bundle-Version: 3.0.0
 Bundle-ClassPath: ibator.jar
 Export-Package: org.apache.ibatis.ibator.ant,
 org.apache.ibatis.ibator.api,
 org.apache.ibatis.ibator.api.dom,
 org.apache.ibatis.ibator.api.dom.java,
 org.apache.ibatis.ibator.api.dom.xml,
 org.apache.ibatis.ibator.config,
 org.apache.ibatis.ibator.config.xml,
 org.apache.ibatis.ibator.exception,
 org.apache.ibatis.ibator.generator,
 org.apache.ibatis.ibator.generator.ibatis2,
 org.apache.ibatis.ibator.generator.ibatis2.dao,
 org.apache.ibatis.ibator.generator.ibatis2.dao.elements,
 org.apache.ibatis.ibator.generator.ibatis2.dao.templates,
 org.apache.ibatis.ibator.generator.ibatis2.model,
 org.apache.ibatis.ibator.generator.ibatis2.sqlmap,
 org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements,
 org.apache.ibatis.ibator.generator.ibatis3,
 org.apache.ibatis.ibator.generator.ibatis3.javamapper,
 org.apache.ibatis.ibator.generator.ibatis3.javamapper.elements,
 org.apache.ibatis.ibator.generator.ibatis3.model,
 org.apache.ibatis.ibator.generator.ibatis3.xmlmapper,
 org.apache.ibatis.ibator.generator.ibatis3.xmlmapper.elements,
 org.apache.ibatis.ibator.internal,
 org.apache.ibatis.ibator.internal.db,
 org.apache.ibatis.ibator.internal.rules,
 org.apache.ibatis.ibator.internal.types,
 org.apache.ibatis.ibator.internal.util

Re: Ibator for ibatis 3

2010-02-19 Thread Jeff Butler
Look at MANIFEST.MF in the ibator.core project.  The Export-Package
directive must list all packages in the ibator.jar file - the version
in SVN needs an update.

A small bit of OSGI loveliness.  That's my best guess.  I'll take a
look at updating this in SVN later today - hopefully :)

Jeff Butler


On Fri, Feb 19, 2010 at 2:21 AM, Guy Rouillier guyr-...@burntmail.com wrote:
 After banging on this for almost 24 hrs straight, I've made some progress,
 but I'm stuck on an Eclipse error when I try to get the context menu on
 ibatorConfig.xml.  I'll put the stack trace at the end because of it's
 length.  I looked in the config and I see these two entries:

 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.IBATOR_JAR=C\:/Program
 Files/Genuitec/Common/plugins/org.apache.ibatis.ibator.core_3.0.0/ibator.jar

 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.IBATOR_JAR_SRC=C\:/Program
 Files/Genuitec/Common/plugins/org.apache.ibatis.ibator.core_3.0.0/ibator-src.zip

 Both of these are accurate, and I verified that the files at those locations
 contain the ibator 3.0 class files, including
 org.apache.ibatis.ibator.generator.XmlConstants.class.  So I don't
 understand why I'm getting the following stack trace in the error log when I
 right-click.  Appreciate some pointers, I'm stuck now:

 java.lang.Error: Unresolved compilation problems:
 The import org.apache.ibatis.ibator.generator cannot be resolved
 XmlConstants cannot be resolved

 at
 org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigVerifyer.init(IbatorConfigVerifyer.java:25)
 at
 org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory.isIbatorConfigurationFile(AdapterFactory.java:85)
 at
 org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory.getAdapter(AdapterFactory.java:46)
 at
 org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:320)
 at
 org.eclipse.core.internal.runtime.AdapterManager.loadAdapter(AdapterManager.java:350)
 at
 org.eclipse.ui.internal.LegacyResourceSupport.getAdapter(LegacyResourceSupport.java:622)
 at
 org.eclipse.ui.internal.ObjectActionContributor.isApplicableTo(ObjectActionContributor.java:223)
 at
 org.eclipse.ui.internal.ObjectContributorManager.isApplicableTo(ObjectContributorManager.java:303)
 at
 org.eclipse.ui.internal.ObjectActionContributorManager.contributeObjectActions(ObjectActionContributorManager.java:83)
 at
 org.eclipse.ui.internal.PopupMenuExtender.addObjectActions(PopupMenuExtender.java:261)
 at
 org.eclipse.ui.internal.PopupMenuExtender.menuAboutToShow(PopupMenuExtender.java:337)
 at
 org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:335)
 at
 org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:463)
 at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:459)
 at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:485)
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:235)
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1008)
 at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4111)
 at org.eclipse.swt.widgets.Control.windowProc(Control.java:3815)
 at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
 at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1576)
 at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:1937)
 at org.eclipse.swt.widgets.Display.windowProc(Display.java:4528)
 at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
 at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:250)
 at org.eclipse.swt.widgets.Display.runPopups(Display.java:3849)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3416)
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
 at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
 at
 org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
 at
 org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
 at
 org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
 at
 org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
 at
 org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
 at
 org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
 at
 org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
 at
 org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179

Re: Ibator for ibatis 3

2010-02-19 Thread Jeff Butler
I just committed some changes to the eclipse plugin code for version
1.2.2.  Things work fine for me.  Also, I updated the instructions for
building the eclipse plugin here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html

Jeff Butler


On Fri, Feb 19, 2010 at 12:31 PM, Guy Rouillier guyr-...@burntmail.com wrote:
 Unfortunately, that's not it.  I had found that manifest and updated it to
 reflect 3.0.0.  I'll try working more on this tonight.  I'll search my
 Eclipse installation and just remove all other instances of the Ibator JAR;
 hopefully then at least Eclipse will give me some big error message
 identifying where it is picking up the older version.  Thanks.

 
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Ibator Core Plug-in
 Bundle-SymbolicName: org.apache.ibatis.ibator.core
 Bundle-Version: 3.0.0
 Bundle-ClassPath: ibator.jar
 Export-Package: org.apache.ibatis.ibator.ant,
  org.apache.ibatis.ibator.api,
  org.apache.ibatis.ibator.api.dom,
  org.apache.ibatis.ibator.api.dom.java,
  org.apache.ibatis.ibator.api.dom.xml,
  org.apache.ibatis.ibator.config,
  org.apache.ibatis.ibator.config.xml,
  org.apache.ibatis.ibator.exception,
  org.apache.ibatis.ibator.generator,
  org.apache.ibatis.ibator.generator.ibatis2,
  org.apache.ibatis.ibator.generator.ibatis2.dao,
  org.apache.ibatis.ibator.generator.ibatis2.dao.elements,
  org.apache.ibatis.ibator.generator.ibatis2.dao.templates,
  org.apache.ibatis.ibator.generator.ibatis2.model,
  org.apache.ibatis.ibator.generator.ibatis2.sqlmap,
  org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements,
  org.apache.ibatis.ibator.generator.ibatis3,
  org.apache.ibatis.ibator.generator.ibatis3.javamapper,
  org.apache.ibatis.ibator.generator.ibatis3.javamapper.elements,
  org.apache.ibatis.ibator.generator.ibatis3.model,
  org.apache.ibatis.ibator.generator.ibatis3.xmlmapper,
  org.apache.ibatis.ibator.generator.ibatis3.xmlmapper.elements,
  org.apache.ibatis.ibator.internal,
  org.apache.ibatis.ibator.internal.db,
  org.apache.ibatis.ibator.internal.rules,
  org.apache.ibatis.ibator.internal.types,
  org.apache.ibatis.ibator.internal.util,
  org.apache.ibatis.ibator.internal.util.messages,
  org.apache.ibatis.ibator.logging,
  org.apache.ibatis.ibator.maven,
  org.apache.ibatis.ibator.plugins
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 =


 On 2/19/2010 9:22 AM, Jeff Butler wrote:

 Look at MANIFEST.MF in the ibator.core project.  The Export-Package
 directive must list all packages in the ibator.jar file - the version
 in SVN needs an update.

 A small bit of OSGI loveliness.  That's my best guess.  I'll take a
 look at updating this in SVN later today - hopefully :)

 Jeff Butler


 On Fri, Feb 19, 2010 at 2:21 AM, Guy Rouillierguyr-...@burntmail.com
  wrote:

 After banging on this for almost 24 hrs straight, I've made some
 progress,
 but I'm stuck on an Eclipse error when I try to get the context menu on
 ibatorConfig.xml.  I'll put the stack trace at the end because of it's
 length.  I looked in the config and I see these two entries:


 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.IBATOR_JAR=C\:/Program

 Files/Genuitec/Common/plugins/org.apache.ibatis.ibator.core_3.0.0/ibator.jar


 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.IBATOR_JAR_SRC=C\:/Program

 Files/Genuitec/Common/plugins/org.apache.ibatis.ibator.core_3.0.0/ibator-src.zip

 Both of these are accurate, and I verified that the files at those
 locations
 contain the ibator 3.0 class files, including
 org.apache.ibatis.ibator.generator.XmlConstants.class.  So I don't
 understand why I'm getting the following stack trace in the error log
 when I
 right-click.  Appreciate some pointers, I'm stuck now:

 java.lang.Error: Unresolved compilation problems:
 The import org.apache.ibatis.ibator.generator cannot be resolved
 XmlConstants cannot be resolved

 at

 org.apache.ibatis.ibator.eclipse.ui.content.IbatorConfigVerifyer.init(IbatorConfigVerifyer.java:25)
 at

 org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory.isIbatorConfigurationFile(AdapterFactory.java:85)
 at

 org.apache.ibatis.ibator.eclipse.ui.content.AdapterFactory.getAdapter(AdapterFactory.java:46)
 at

 org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:320)
 at

 org.eclipse.core.internal.runtime.AdapterManager.loadAdapter(AdapterManager.java:350)
 at

 org.eclipse.ui.internal.LegacyResourceSupport.getAdapter(LegacyResourceSupport.java:622)
 at

 org.eclipse.ui.internal.ObjectActionContributor.isApplicableTo(ObjectActionContributor.java:223)
 at

 org.eclipse.ui.internal.ObjectContributorManager.isApplicableTo(ObjectContributorManager.java:303)
 at

 org.eclipse.ui.internal.ObjectActionContributorManager.contributeObjectActions(ObjectActionContributorManager.java:83

Re: Ibator for ibatis 3

2010-02-17 Thread Jeff Butler
I've learned the hard way not to make projections as to when something
will be completed :)

I need to make some updates to the Ibator documentation, and then go
through the arduous release process - not too fun.  I'm also using
Ibator and iBATIS3 on a new project, so I have added a few new
features to Ibator to make my own coding life easier.

I can say that I'm using Ibator and iBATIS3 nearly every day for real
work and have run into very few troubles.  When will there be a new
release?  I always say soon, hopefully.

Jeff Butler



On Wed, Feb 17, 2010 at 12:45 AM, Guy Rouillier guyr-...@burntmail.com wrote:
 On 11/8/2009 7:11 PM, Jeff Butler wrote:

 Ibator updates for iBATIS3 are now in SVN.  I won't do a formal
 release for a few days as I need to update the docs, but feel free to
 check it out and play with it.  Ibator is now built with Maven rather
 than Ant, so you'll need to know how to do a Maven build.  All the
 tests pass, but there might be some situations I've not anticipated.
 Let me know if you encounter any difficulties.  The SVN link is here:

 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/

 Jeff, iBATIS is now spreading through our company; thanks again to the whole
 development team for your hard work on such a useful platform.

 Any updates on a binary build of Ibator compatible with version 3 of iBATIS?
  I'm interested in the Eclipse plugin as well as core.  Someone called me
 today asking about old bugs in 1.2.1 so I provided him with my local binary
 of 1.2.2, but would like to get the version 3 updates.

 Thanks.

 --
 Guy Rouillier

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: If all my sql is in xml, do I gain that much (assuming unit tests) using Mapper objects as well?

2010-02-17 Thread Jeff Butler
Using a mapper interface means you have a bit less code to write and
generics support comes for free without having to do the
@SuppressWarnings annotation.  Refactoring support is limited because
the mapper interface name and method names must match the XML - so
simply changing something in the mapper interface might break the
code.

The mapper is doing the same thing under the covers as what you
describe - so there's no other magic.  In my current project I'm using
the mapper interface because I like to write less code, and Ibator
generated most of the mapper methods anyway.

Jeff Butler


On Wed, Feb 17, 2010 at 1:38 PM, Rick R ric...@gmail.com wrote:
 This probably has been brought up before, but a quick search on nabble
 didn't return anything that useful at the moment...

 Our plan is to have ALL sql in the mapper xml files (not annotations.) It
 'seems' like the only real benefit we'd then get out of also providing a
 corresponding mapper object is for IDE support and catching of any invalid
 calls early on (and maybe refactoring is slightly cleaner but that's
 debatable.)  But assuming we have a unit test for every mapper sql command
 in our service layer, is there anything else I miss by skipping the whole
 creation of mapper objects and simply going after the sql the old way...
 session.update(fooBar.updateEmployee, obj) ? (I read pages 53/54 of the
 guide and nothing jumped out at me as a huge gain in our case using Mapper
 classes.)

 I just don't want to be overlooking anything.

 --
 Rick R


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: If all my sql is in xml, do I gain that much (assuming unit tests) using Mapper objects as well?

2010-02-17 Thread Jeff Butler
In my case, it's a bit less code:

Mapper interface:
ListMyObject getByCompoundKey(@Param(id1) Integer id1,
@Param(id2) Integer id2);

versus

Method in some class:
@SupressWarnings(unchecked)
ListMyObject getByCompoundKey(Integer id2, Integer id2) {
  Map parms = new HashMap();
  parms.put(id1, id1);
  parms.put(id2, id2);
  return sqlSession.selectList(foo.Bar.getById, parms);
}

YMMV.

Jeff Butler



On Wed, Feb 17, 2010 at 2:36 PM, Rick R ric...@gmail.com wrote:
 On Wed, Feb 17, 2010 at 2:51 PM, Jeff Butler jeffgbut...@gmail.com wrote:

 Using a mapper interface means you have a bit less code to write

 How is it less code?, that's my whole point in dropping it since I think it
 adds more code (for in our case seemingly little gain.) All my sql is in xml
 and for every mapper xml statement I create I have to go over and add a
 Mapper interface method. It's just one more piece of code that needs
 attention.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBatis 3.x common sql fragments?

2010-02-08 Thread Jeff Butler
I'm doing this (across different xml files). I believe ibatis is still
load order dependant - so your fragments file needs to be loaded in
the configuration before the file that uses the fragments.

Jeff Butler


On 2/8/10, Alex Sherwin alex.sher...@acadiasoft.com wrote:
 Martin Ellis wrote:
 On 8 February 2010 14:40, Alex Sherwin alex.sher...@acadiasoft.com
 wrote:

 I'm trying to create a common Sql Map XML file that will contain some
 common fragments.  In iBatis 2.x this was easy enough, the fragments were
 referenced by other Sql Map files by using include
 refid=fully.qualified.ns.Statement/

 I assumed the same would be true for iBatis 3.x as well, but doesn't seem
 to
 be working for me. Right now, the only mapper I have in my config xml in
 the
 mappers element is my common xml fragment, while the rest of my mappers
 are registered with iBatis programatically.  I gave my common Sql Map a
 namespace of common, and tried to reference a statement from another
 SqlMap with sql refid=common.params/, I see this exception:


 I'm using something like this, which works fine:

   select id=series parameterType=map resultMap=...
 SELECT ...
 where
   include refid=seriesFilter/
 /where
   /select

   sql id=seriesFilter
 ...

 N.B. The tag I'm using is 'include', and I didn't need to qualify the sql
 id.

 Martin

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 That does work, within the same XML document; I'm trying to reference a
 sql fragment that is defined in a different XML document

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBatis 3.x common sql fragments?

2010-02-08 Thread Jeff Butler
Yes - everything's in xml for me.

Jeff Butler


On 2/8/10, Alex Sherwin alex.sher...@acadiasoft.com wrote:
 Are you registering your mappers all in the configuration XML?  I tried
 to programatically register my common SqlMap file first, and I'm still
 having the same problem.  I'm wondering if that is my problem

 Jeff Butler wrote:
 I'm doing this (across different xml files). I believe ibatis is still
 load order dependant - so your fragments file needs to be loaded in
 the configuration before the file that uses the fragments.

 Jeff Butler


 On 2/8/10, Alex Sherwin alex.sher...@acadiasoft.com wrote:

 Martin Ellis wrote:

 On 8 February 2010 14:40, Alex Sherwin alex.sher...@acadiasoft.com
 wrote:


 I'm trying to create a common Sql Map XML file that will contain some
 common fragments.  In iBatis 2.x this was easy enough, the fragments
 were
 referenced by other Sql Map files by using include
 refid=fully.qualified.ns.Statement/

 I assumed the same would be true for iBatis 3.x as well, but doesn't
 seem
 to
 be working for me. Right now, the only mapper I have in my config xml
 in
 the
 mappers element is my common xml fragment, while the rest of my
 mappers
 are registered with iBatis programatically.  I gave my common Sql Map a
 namespace of common, and tried to reference a statement from another
 SqlMap with sql refid=common.params/, I see this exception:


 I'm using something like this, which works fine:

   select id=series parameterType=map resultMap=...
 SELECT ...
 where
   include refid=seriesFilter/
 /where
   /select

   sql id=seriesFilter
 ...

 N.B. The tag I'm using is 'include', and I didn't need to qualify the
 sql
 id.

 Martin

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 That does work, within the same XML document; I'm trying to reference a
 sql fragment that is defined in a different XML document

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org







 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: table name as parameter

2010-02-08 Thread Jeff Butler
Look at the @Param annotation.  If you pass more than one parameter to
a mapper method, them you must annotate ALL parameters:

ListMap selectAllFromTable(@Param(rowBounds) RowBounds rowBounds,
@Param(tableName) String tableName);

Whenever I forget to do this, I see errors about NULL values.

Jeff Butler

On Mon, Feb 8, 2010 at 4:57 PM, Tom Carchrae carch...@gmail.com wrote:



 nmaves wrote:

 I would double check that you are not sending in null as the table name.


 I am passing in a non-null string.  But it is definitely a problem caused by
 the table name not being mapped correctly.

 When i traced down inside the bowels of iBatis, it gobbles my string inside

 TextSqlNode.java:38

        Object value = Ognl.getValue(content, context.getBindings());

 Up to this point, it's all looking so good.  Figuring out what is going on
 inside the OgnlParser is, well, a touch intimidating.

 Tom


 --
 View this message in context: 
 http://old.nabble.com/table-name-as-parameter-tp27505213p27507728.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: table name as parameter

2010-02-08 Thread Jeff Butler
Well, I wasn't quite right in what I said.  RowBounds is the exception
to the rule - so if you pass more than one parameter in addition to
RowBounds, then you must use the @Param annotation.  In your case, you
don't need to annotate and value is the right default.

Jeff Butler


On Mon, Feb 8, 2010 at 5:12 PM, Tom Carchrae carch...@gmail.com wrote:



 Jeff Butler-2 wrote:

 Look at the @Param annotation.  If you pass more than one parameter to
 a mapper method, them you must annotate ALL parameters:

 ListMap selectAllFromTable(@Param(rowBounds) RowBounds rowBounds,
 @Param(tableName) String tableName);

 Whenever I forget to do this, I see errors about NULL values.


 This makes sense.  I had wondered what magic it was using to make the
 mapping between the parameter name and the select statement.  (ie, none, or
 as Larry pointed out, 'value' is a default mapping name)

 Thanks for the tip. :)

 Tom
 --
 View this message in context: 
 http://old.nabble.com/table-name-as-parameter-tp27505213p27507890.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator build from source 1.2.1 running error

2010-01-27 Thread Jeff Butler
I'm not sure, but you could try compiling with the latest source.
There have been a lot of changes in Ibator since 1.2.1.  You can
checkout the latest source tree here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/

Ibator now builds with Maven2 so you should already have everything you need.

Jeff Butler




On Wed, Jan 27, 2010 at 2:23 AM, kevin zhao kevin...@gmail.com wrote:
 Hi there,

 I'm trying to build ibator from source that I downloaded form this address
 http://people.apache.org/builds/ibatis/ibator/ibator-1.2.1-681.zip.

 The tool I'm building with is Maven2 and the build is OK as I got the jar
 file generated.
 However, I got some error when I was trying to run it from the command line.

 The error is as follows
 java.net.MalformedURLException
  at java.net.URL.init(URL.java:601)
  at java.net.URL.init(URL.java:464)
  at java.net.URL.init(URL.java:413)
  at
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:650)
  at
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
  at
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1089)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1002)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
  at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
  at
 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
  at
 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
  at
 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
  at
 com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
  at
 com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
  at
 org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser.parseIbatorConfiguration(IbatorConfigurationParser.java:134)
  at
 org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser.parseIbatorConfiguration(IbatorConfigurationParser.java:107)
  at
 org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser.parseIbatorConfiguration(IbatorConfigurationParser.java:99)
  at org.apache.ibatis.ibator.api.IbatorRunner.main(IbatorRunner.java:95)

 The command line I typed is as follows
 D:\Java\ibatorTestjava -jar ibator.jar -configfile config.xml

 The content of the config.xml file is as follows,
  ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE ibatorConfiguration PUBLIC -//Apache Software Foundation//DTD
 Apache iBATIS Ibator Configuration 1.0//EN
 http://ibatis.apache.org/dtd/ibator-config_1_0.dtd; 
 ibatorConfiguration 
   classPathEntry location=D:\Temp\mysql-connector-java-5.1.6.jar /
   ibatorContext id=context1 targetRuntime=Ibatis2Java5

     jdbcConnection driverClass=com.mysql.jdbc.Driver
 connectionURL=jdbc:mysql://localhost:3306/piratebase userId=piratebase
 password=hello123 

     /jdbcConnection
     javaModelGenerator targetPackage=com.meidusa.pirateweb.dal.model
 targetProject=pirateweb-dal /
     sqlMapGenerator targetPackage=com.meidusa.pirateweb.dal.sqlmap
 targetProject=pirateweb-dal/src/main/resources /
     daoGenerator targetPackage=com.meidusa.pirateweb.dal
 targetProject=pirateweb-dal type=SPRING 
  property name=rootInterface
 value=com.meidusa.pirateweb.dal.AbstractDAOlt;PostReply,
 PostReplyExamplegt;/
     /daoGenerator
     table schema=piratebase tableName=pb_post_reply
 domainObjectName=PostReply/
   /ibatorContext
 /ibatorConfiguration

 However, it's running fine if I use the precompiled jar instead inlcluded in
 the distribution.

 Is there any light to be shed on?

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Strange data/number clobbered problem

2010-01-26 Thread Jeff Butler
That's a really old version of iBATIS.  Look in the V2 developer's
guide for the numericScale attribute of a parameter map (either
inline or declared).  You'll need to upgrade to a newer version of
iBATIS to use it.  This will likely fix the problem.  Older versions
of iBATIS did not handle this properly.

Jeff Butler

On Tue, Jan 26, 2010 at 6:32 PM, Wu, Daniel daniel...@smss.sony.com wrote:
 Hi,



 We recently encountered some issues which potentially related to iBitis.

 We searched the web and the mailing list archive but did not find
 anything useful so far.  I am submitting this to the mailing list to see
 if anyone has encountered this problem before and/or maybe point me some
 direction.



 We are using iBatis 2.1.7.597 or our production environment.  It is a
 java web application deployed to a farm of tomcat 5.5.27.  On one
 instance of the tomcat farm, the decimal point of numerical value was
 clobbered; the rest of the instances in the farm seems to be ok.  To
 troubleshoot, we isolated the instance and hot deployed new modified web

 app in the same tomcat container.      The modified app is compiled from

 same branch of source code but we added some logging and a jsp page to
 allow us to run ad-hoc sql query.



 The modified app still shows the wrong numerical value, but the value is
 correct when we did direct sql execution through the jsp page.  We
 turned on the logging java.sql.* and saw the logging output that we
 believe is coming from iBatis:



 2010-01-26 19:59:11,889 [TP-Processor6] DEBUG java.sql.ResultSet -
 {rset-100101} Result: [30453, New Releases $9.99 , 9.99 price for new
 releases, N, 0, 0.0, 2009-04-03 02:00:00.0, 2012-04-03 19:00:42.0,

 2009-04-03 19:00:53.0, 2010-01-18 21:18:12.0, SSD]



 Where the 0.0 supposed to be 9.9.  The pattern of the issue is that the
 decimal point is shifted in the value, for example 15.95 becomes 159.5.



 We are currently stuck because we don't want to bounce the instance and
 we are not exactly sure how to trigger issue.  We can only suspect that
 there are some funny thing going on between iBatis and jdbc.



 Again, please let me know if you have seen this issue.  Thank you in
 advance.



 Daniel Wu




 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: insert going wrong after going from Sybase to MySQL

2010-01-23 Thread Jeff Butler
Use the insert... form.

Then do this in Java:

Integer id = sqlMap.insert(insertChesser, parameter);

statement is a holdover from iBATIS 1.x I believe.

Jeff Butler


On Sat, Jan 23, 2010 at 4:20 PM, StevenF ste...@web2.filipowicz.com wrote:

 Hi Guys,

 Still no luck here.

 I have this, but doesn't work:
 
    statement id = insertChesser
 parameterClass=nl.chessone40.domain.Chesser 
    selectKey resultClass=int keyProperty=chesserId
      select last_insert_id() as value
    /selectKey
        INSERT INTO Chesser
            (login,
            password,
            firstName,
            lastName,
            credits)
        values
            (#login#,
            #password#,
            #firstName#,
            #lastName#,
            #credits#)
    /statement
 

 Also tried:
 
    insert id = insertChesser
 parameterClass=nl.chessone40.domain.Chesser 
    selectKey resultClass=int keyProperty=chesserId
      select last_insert_id() as value
    /selectKey
        INSERT INTO Chesser
            (login,
            password,
            firstName,
            lastName,
            credits)
        values
            (#login#,
            #password#,
            #firstName#,
            #lastName#,
            #credits#)
    /insert 
 ---

 This gives an error:
 SqlMapClient operation; uncategorized SQLException for SQL []; SQL state
 [null]; error code [0]; Insert statements cannot be executed as a query.;
 nested exception is java.sql.SQLException: Insert statements cannot be
 executed as a query.

 What is the difference between statement id=... and insert id=... ?

 Thanks for the help!!


 Niels Beekman-2 wrote:

 Your XML is simply invalid, use an editor that supports DTD validation.
 The selectKey element can only be used inside select elements.

 I also think that resultClass=java.lang.Long is obsolete, and should
 be removed.

 Niels




 --
 View this message in context: 
 http://old.nabble.com/insert-going-wrong-after-going-from-Sybase-to-MySQL-tp27274795p27290482.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator couldnt find jdbc driver

2010-01-12 Thread Jeff Butler
You need to add a classPathEntry element to add the JAR to the classpath.

Jeff Butler


On Tue, Jan 12, 2010 at 9:13 AM, olamalam ilker.cikrikc...@aspone.co.uk wrote:

 Hi to all,

 I have a problem with the eclipse plugin of ibatis.
 I've generated a ibatorConfiguration xml file and filled its fields:
 ibatorConfiguration 
  ibatorContext id=context1 
    jdbcConnection driverClass=com.mysql.jdbc.Driver
 connectionURL=jdbc:mysql://localhost:3306/music userId=root
 password=root /
    javaModelGenerator targetPackage=com.ociweb.music.model
 targetProject=\SampleIbatis\src /
    sqlMapGenerator targetPackage=test.xml
 targetProject=\SampleIbatis\src /
    daoGenerator targetPackage=com.ociweb.music.dao
 targetProject=\SampleIbatis\src type=GENERIC-CI /
    table schema=music tableName=artists 
      columnOverride column=name property=name /
    /table
  /ibatorContext
 /ibatorConfiguration

 then when I click on Generate iBatis artifacts i get an Unexpected error
 while running Ibator.
 Exception getting JDBC Driver error.

 I'm using mySql and my mySql-connector.jar file is in referenced libraries.
 also I've added the jar file to the class path. I checked it from comment
 prompt, the system sees com.mysql.jdbc.Driver.class.

 what should i do?

 thanks in advance...

 --
 View this message in context: 
 http://old.nabble.com/ibator-couldnt-find-jdbc-driver-tp27129063p27129063.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator couldnt find jdbc driver

2010-01-12 Thread Jeff Butler
Sorry - you need the entry in your ibatorconfig file - not the
.classpath file. Eclipse plugins have a different classpath than the
eclipse project classpath.

Jeff Butler


On 1/12/10, olamalam ilker.cikrikc...@aspone.co.uk wrote:

 I have it:

 classpath
   classpathentry kind=src path=src/
   classpathentry kind=con
 path=org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5/
   classpathentry kind=lib
 path=E:/setup/ibatis/ibatis-2.3.4.726/lib/ibatis-2.3.4.726.jar/
   classpathentry kind=lib
 path=E:/setup/mysql/mysql-connector-java-5.1.10/mysql-connector-java-5.1.10-bin.jar/
   classpathentry kind=var path=IBATOR_JAR 
 sourcepath=IBATOR_JAR_SRC/
   classpathentry kind=output path=bin/
 /classpath




 Jeff Butler-2 wrote:

 You need to add a classPathEntry element to add the JAR to the
 classpath.

 Jeff Butler


 On Tue, Jan 12, 2010 at 9:13 AM, olamalam ilker.cikrikc...@aspone.co.uk
 wrote:

 Hi to all,

 I have a problem with the eclipse plugin of ibatis.
 I've generated a ibatorConfiguration xml file and filled its fields:
 ibatorConfiguration 
  ibatorContext id=context1 
    jdbcConnection driverClass=com.mysql.jdbc.Driver
 connectionURL=jdbc:mysql://localhost:3306/music userId=root
 password=root /
    javaModelGenerator targetPackage=com.ociweb.music.model
 targetProject=\SampleIbatis\src /
    sqlMapGenerator targetPackage=test.xml
 targetProject=\SampleIbatis\src /
    daoGenerator targetPackage=com.ociweb.music.dao
 targetProject=\SampleIbatis\src type=GENERIC-CI /
    table schema=music tableName=artists 
      columnOverride column=name property=name /
    /table
  /ibatorContext
 /ibatorConfiguration

 then when I click on Generate iBatis artifacts i get an Unexpected
 error
 while running Ibator.
 Exception getting JDBC Driver error.

 I'm using mySql and my mySql-connector.jar file is in referenced
 libraries.
 also I've added the jar file to the class path. I checked it from comment
 prompt, the system sees com.mysql.jdbc.Driver.class.

 what should i do?

 thanks in advance...

 --
 View this message in context:
 http://old.nabble.com/ibator-couldnt-find-jdbc-driver-tp27129063p27129063.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 View this message in context:
 http://old.nabble.com/ibator-couldnt-find-jdbc-driver-tp27129063p27130546.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator generate incomplete bean

2009-12-30 Thread Jeff Butler
Try this:

table tableName=someTable schema=someSchema
  property name=ignoreQualifiersAtRuntime value=true/
/table

Jeff Butler

On Wed, Dec 30, 2009 at 7:20 AM, ines DNSCE dnsce-i...@live.fr wrote:

 The reason is that the reading of the given méta data has the right DBA.
 Thus I reads méta data of another plan (schéma) than I waited.
 If I specify the plan for every table, I have no more the problem. On the
 other hand it adds me in prefix the name of the plan, I must be able to
 configure it to ignore the prefix and not to have to specified un each table
 the plan.

 
 From: dnsce-i...@live.fr
 To: user-java@ibatis.apache.org
 Subject: RE: Ibator generate incomplete bean
 Date: Wed, 30 Dec 2009 11:15:16 +0100

 The Oracle columns are number(1) and number(8). Ibator don't show me
 warnings.


 From: jeffgbut...@gmail.com

 Usually Ibator will ignore a column only if it encounters an
 unsupported data type. Ibator should show a warning if that happens.

 Unsupported data typed are fairly common with Oracle. Check the data
 types of the missing columns - that might give us a better idea of
 what's wrong.

 Jeff Butler



 
 Avec Internet Explorer, surfez en toute discrétion sur internet Cliquez ici
 !

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator generate incomplete bean

2009-12-29 Thread Jeff Butler
Usually Ibator will ignore a column only if it encounters an
unsupported data type.  Ibator should show a warning if that happens.

Unsupported data typed are fairly common with Oracle. Check the data
types of the missing columns - that might give us a better idea of
what's wrong.

Jeff Butler


On 12/29/09, ines DNSCE dnsce-i...@live.fr wrote:











 Ibatis 2.3.0.677
 Abator 1.2.1
 Eclipse Java EE IDE for Web Developers. Build id: 20090920-1017 Galileo
 Oracle 10g
 Spring

 Hello,

 I install Abator and when I generate Ibatis Artifacts, I have problem on 2
 of my generated bean: an attribute is missing. For other tables, the bean
 genarated is ok, but in this case, one attribute is missing. Why I can't
 have all the attributes of my table oracle in the generated bean ?
 I need help to have all the attribute in all my generated bean, because I
 need the correct beanExample generated and the entire sqlMap generated.


 Before, I used Abator, I didn't have this problem. Since I change for
 Ibator, I have this problem.

 With Abator I haved another problem: when I rename columns Oracle (direct in
 the data base) and I generate Ibatis Artifacts to update my java code, the
 old column name was always present in generated bean and the new column name
 was present too. I need to add on abatorConfig.xml ignorecolumn of the old
 column name to go working well.
 With my new problem with Ibator, I can't work.

 Best regards,

 Ines  
 _
 Nouveau ! Tout Windows Live débarque dans votre téléphone. Voir les Windows
 phone
 http://clk.atdmt.com/FRM/go/175819071/direct/01/

-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Beta 6 Oracle Invalid column type: getCLOB not implemented

2009-12-13 Thread Jeff Butler
I believe I have found and fixed the error in iBATIS.  Please try
building from SVN and let me know if the issue is resolved.

Jeff Butler


On Fri, Dec 11, 2009 at 11:10 PM, Guy Rouillier guyr-...@burntmail.com wrote:
 I've posted an update to Jira issue IBATIS-712.  I can get this to fail
 repeatedly with a simple command line program, on either Windows or Linux,
 with either JDK 5 or JDK 6 and any Oracle driver appropriate for the JDK
 version.  We are using Oracle 10g 10.0.2.0.3.

 Please let me know what else I can do to assist in debugging this.  This is
 an obvious showstopper for us to deploy our app with iBATIS.

 Thanks.

 On 12/10/2009 1:06 PM, Guy Rouillier wrote:

 On 12/10/2009 12:19 PM, Jeff Butler wrote:

 JDBC 3 has always been a requirement. There was a change in this area
 in ibatis but I don't recall the particulars right now. I'll need to
 do a bit of research to recall.

 Hmmm works on windows but not on linux? I'd double check to make sure
 that there is not an older driver sneaking into the mix on linux.

 I created a simple JSP in the same Tomcat context as our application, to
 make sure it would load the same JDBC driver as our app. Here is what I
 executed:

 %
 ... get a connection
 DatabaseMetaData dmd = conn.getMetaData();
 aDriverVersion = dmd.getDriverVersion();
 %

 p Driver version: %= aDriverVersion %


 On both Windows and Linux, the result is

 Driver version: 11.2.0.1.0

 Please let me know if I can help in any way to isolate this issue. Thanks.


 On 12/10/09, Guy Rouillierguyr-...@burntmail.com wrote:

 On 12/10/2009 11:33 AM, Jeff Butler wrote:

 This method (getCLOB) is a JDBC 3 method. You must now use a driver
 that is JDBC 3 compliant.

 I'm using the ojdbc6.jar driver from 11g (although our databases are
 10g, the 11g drivers are required for JDK 6.) The Oracle JDBC FAQ says
 this about JDBC version support:

 Oracle 11.1.0 and 11.2.0 support:

 Full support for JDBC 3.0 in the JDK 1.5 drivers.
 Full support for JDBC 4.0 in the JDK 1.6 drivers with the
 exception of SQLXML which is not supported.

 I wouldn't think the JDBC 3 requirement was introduced between Beta 5
 and Beta 6, right? The code works fine with the Beta 5 code.

 The best hint I could find with some quick Googling is that getCLOB
 should not be used to retrieve a VARCHAR column. All the character
 columns in the table I supplied in the Jira issue are VARCHAR; the table
 has no CLOB columns.

 I'm also at a loss to figure out why everything works fine on Windows
 but fails on Linux. Same Oracle driver, same JDK version, same Tomcat
 version. Obviously, the VM is native code.

 Something has changed between Beta 5 and Beta 6 to cause this.

 Thanks.


 On 12/10/09, Guy Rouillierguyr-...@burntmail.com wrote:

 I'm getting a catastrophic failure with Beta 6 that does not happen
 with
 Beta 5. I opened Jira issue IBATIS-712 for this:

 https://issues.apache.org/jira/browse/IBATIS-712: Oracle Invalid
 column
 type: getCLOB not implemented for class
 oracle.jdbc.driver.T4CVarcharAccessor

 Thanks.

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org







 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Beta 6 Oracle Invalid column type: getCLOB not implemented

2009-12-10 Thread Jeff Butler
This method (getCLOB) is a JDBC 3 method. You must now use a driver
that is JDBC 3 compliant.

Jeff Butler


On 12/10/09, Guy Rouillier guyr-...@burntmail.com wrote:
 I'm getting a catastrophic failure with Beta 6 that does not happen with
 Beta 5.  I opened Jira issue IBATIS-712 for this:

 https://issues.apache.org/jira/browse/IBATIS-712: Oracle Invalid column
 type: getCLOB not implemented for class
 oracle.jdbc.driver.T4CVarcharAccessor

 Thanks.

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Beta 6 Oracle Invalid column type: getCLOB not implemented

2009-12-10 Thread Jeff Butler
JDBC 3 has always been a requirement. There was a change in this area
in ibatis but I don't recall the particulars right now. I'll need to
do a bit of research to recall.

Hmmm works on windows but not on linux? I'd double check to make sure
that there is not an older driver sneaking into the mix on linux.

Jeff Butler


On 12/10/09, Guy Rouillier guyr-...@burntmail.com wrote:
 On 12/10/2009 11:33 AM, Jeff Butler wrote:
 This method (getCLOB) is a JDBC 3 method. You must now use a driver
 that is JDBC 3 compliant.

 I'm using the ojdbc6.jar driver from 11g (although our databases are
 10g, the 11g drivers are required for JDK 6.)  The Oracle JDBC FAQ says
 this about JDBC version support:

 Oracle 11.1.0 and 11.2.0 support:

Full support for JDBC 3.0 in the JDK 1.5 drivers.
Full support for JDBC 4.0 in the JDK 1.6 drivers with the
 exception of SQLXML which is not supported.

 I wouldn't think the JDBC 3 requirement was introduced between Beta 5
 and Beta 6, right?  The code works fine with the Beta 5 code.

 The best hint I could find with some quick Googling is that getCLOB
 should not be used to retrieve a VARCHAR column.  All the character
 columns in the table I supplied in the Jira issue are VARCHAR; the table
 has no CLOB columns.

 I'm also at a loss to figure out why everything works fine on Windows
 but fails on Linux.  Same Oracle driver, same JDK version, same Tomcat
 version.  Obviously, the VM is native code.

 Something has changed between Beta 5 and Beta 6 to cause this.

 Thanks.


 On 12/10/09, Guy Rouillierguyr-...@burntmail.com  wrote:
 I'm getting a catastrophic failure with Beta 6 that does not happen with
 Beta 5.  I opened Jira issue IBATIS-712 for this:

 https://issues.apache.org/jira/browse/IBATIS-712: Oracle Invalid column
 type: getCLOB not implemented for class
 oracle.jdbc.driver.T4CVarcharAccessor

 Thanks.

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: separate package for ...Example classes

2009-11-17 Thread Jeff Butler
You can change the example package with a plugin.  The sample plugin
RenameExampleClassPlugin shows the technique (you should do it in
the initialized method of a plugin).

You can add property elements to table to specify table specific
properties.  These properties can be accessed in a plugin
(IntrospectedTable.getTableConfigurationProperty(String), or
IntrospectedTable.getTableConfiguration().getProperties()).

Jeff Butler

2009/11/17 Tomáš Procházka t.procha...@centrum.cz:

 Hi.

 It's possible change package where ...Example classes will be generated?
 This will be great optional parameter for javaModelGenerator element.
 I need put them to another package, because I developing ExtGWT application 
 and model class are part of public API which will be compiled to JavaScript 
 and Example classes doesn't.
 I already write plugin which can generate model classes like extension of 
 BaseModel class for ExtGWT library

 And second question. It's possible add per table configuration to table 
 element which will be accessible in plugins? I wont plugin which will be 
 automatically generate constructor with fields which I choose.

 --
 Tomáš Procházka

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: What I miss in Ibator (was: Re: what contain int return value for insert?)

2009-11-15 Thread Jeff Butler
I used part of your patch for column defaults - I added to attribute
in the introspected column and filled it in with the database
introspector.  You can do the rest of your patch with a plugin.

Thanks!
Jeff Butler


2009/11/15 Tomáš Procházka t.procha...@centrum.cz:

 Thanks you. This is great, only small problem is that I must define the same 
 think to all table, but it work!

 I already wrote plugin for support limiting result by RowBounds.
 Here is:

 http://www.atomsoft.cz/projekty/java/ibator-plugins/SelectByLimitPlugin.java

 I also implementing generation default value for field. Very simple way for 
 my needs. It can't be done by plugin so I modify ibator direclty, here is 
 patch:
 http://www.atomsoft.cz/projekty/java/ibator-plugins/defaultFieldValue.patch

 You can use it as can.


 I already miss only support for foreign key for automatic generation 
 something like this:

 resultMap id=blogResult type=Blog
  
  association property=author column=blog_author_id javaType=Author
 select=selectAuthor/
 /resultMap

 __
 Od: Jeff Butler jeffgbut...@gmail.com
 Komu: user-java@ibatis.apache.org
 Datum: 14.11.2009 22:12
 Předmět: Re: what contain int return value for insert?

The return value from the insert method is the number of rows inserted
(in iBATIS3).

Ibator will generated the proper code for generated keys - see the
generatedKey configuration element in the documentation.

Jeff Butler


2009/11/14 Tomáš Procházka t.procha...@centrum.cz:

 What contain return int value for this mapper method:

 int insert(Group record);

 with this mapping delcaration:

  insert id=insert parameterType=test.model.Group 
insert into `group` (id, name, type,
  locked, lockedby_user)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
 #{type,jdbcType=CHAR},
  #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})
  /insert

 ?

 A prefer automatically return last insert id, it's possible?

 I tried this:

selectKey keyProperty=id resultType=integer
 SELECT LAST_INSERT_ID();
/selectKey

 It update field in Group instance which was used to call insert method, But 
 has no result to insert method return value.


selectKey keyProperty=id resultType=integer SELECT 
 LAST_INSERT_ID();/selectKey

 This should be automatically generated by Ibator. It's very important for 
 easy way to build related DB data.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: what contain int return value for insert?

2009-11-15 Thread Jeff Butler
Fixed in SVN.  Thanks!

Jeff Butler


2009/11/15 Tomáš Procházka t.procha...@centrum.cz:

 I found problem, generatedKey produce this:

 selectKey keyProperty=id resultType=java.lang.Integer type=post 

 should be use order=AFTER instead of type=post?

 __
 Od: Jeff Butler jeffgbut...@gmail.com
 Komu: user-java@ibatis.apache.org
 Datum: 14.11.2009 22:12
 Předmět: Re: what contain int return value for insert?

The return value from the insert method is the number of rows inserted
(in iBATIS3).

Ibator will generated the proper code for generated keys - see the
generatedKey configuration element in the documentation.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: what contain int return value for insert?

2009-11-14 Thread Jeff Butler
The return value from the insert method is the number of rows inserted
(in iBATIS3).

Ibator will generated the proper code for generated keys - see the
generatedKey configuration element in the documentation.

Jeff Butler


2009/11/14 Tomáš Procházka t.procha...@centrum.cz:

 What contain return int value for this mapper method:

 int insert(Group record);

 with this mapping delcaration:

  insert id=insert parameterType=test.model.Group 
    insert into `group` (id, name, type,
      locked, lockedby_user)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
 #{type,jdbcType=CHAR},
      #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})
  /insert

 ?

 A prefer automatically return last insert id, it's possible?

 I tried this:

                selectKey keyProperty=id resultType=integer
                         SELECT LAST_INSERT_ID();
                /selectKey

 It update field in Group instance which was used to call insert method, But 
 has no result to insert method return value.


                selectKey keyProperty=id resultType=integer SELECT 
 LAST_INSERT_ID();/selectKey

 This should be automatically generated by Ibator. It's very important for 
 easy way to build related DB data.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Collection with composite key in XML mapping

2009-11-12 Thread Jeff Butler
Open a JIRA ticket.  If you can attach a path and a test case that
would be even better.

Jeff Butler


On Thu, Nov 12, 2009 at 12:17 PM, Byron Tymvios by...@scube.co.za wrote:
 I have downloaded the latest trunk of iBatis 3 from SVN and did some
 debugging. It appears as if the composite key notation
 #{param1=col1,param2=col2} is never passed when building the
 ResultMapping. This results in the composite key only being treated as a
 regular column. The composites List in ResultMapping is only ever
 initialized to a new ArrayList but never populated with anything meaningful.
 Then when applying the results from the ResultSet the isComposite() method
 always returns false and so the nested select is never executed.

 What is the process to follow to have this corrected?

 Regards
  Byron

 btymvios wrote:

 Hi All,

 Please if possible could someone assist me, I have been banging my head on
 this problem for near a week now and this is holding my project up
 seriously. I have tried everything I can think of and everything I can
 find.
 As soon as I include the composite key mapping of
 column=”{prop1=col1,prop2=col2}” in my xml mapping files the nested select
 is never executed and no error is reported/thrown. Am I doing something
 wrong in my mappings?

 I have also included the #{id, javaType=int, jdbcType=Numeric} but also
 with
 no luck.

 Kind Regards
  Byron


 btymvios wrote:


 Apologies, there is a typo in my last post the select should have read:
    select id=nestedSelect parameterType=map
 resultMap=myTypeResultMap
        SELECT *
        FROM my_type_table
        WHERE other_id = #{id} AND client_id = #{clientId}
    /select


 btymvios wrote:


 Hi All,

 Please could someone assist, I know this might be a silly question with
 a
 simple answer but I have tried all examples I have found, I have read
 the
 documentation and I have searched the forums and the internet but to no
 avail.

 I am using the latest beta version of iBatis 3 (beta 5) but had the same
 problem with beta 4. In iBatis v2x these complex key mappings worked
 fine.

 The documentation states:

 Note: To deal with composite keys, you can specify multiple column
 names
 to pass to the nested select statement by using the syntax
 column=”{prop1=col1,prop2=col2}”. This
 will cause prop1 and prop2 to be set against the parameter object for
 the
 target nested select statement.

 However when I specify this with multiple columns for a collection the
 nested select is never run and no error is reported. In the referenced
 select I am accessing the parameters by #{param1Name} and
 #{param2Name}
 (where param1Name is the name of the first param etc..).

 If I remove this and only specify one parameter like column=col_1 then
 the referenced select is executed and the same param is used for both
 parameter mapping in the select. So the collection mapping can access
 the
 nested select and return a list of the correct type (albeit with a lot
 of
 incorrect rows due to not matching on the full complex key) but not when
 I have complex keys specified.

 What is the correct notation for using multiple columns for complex keys
 from a collection mapping. There are no examples in the documentation
 other than the excerpt above. I have also not found any workable
 examples
 on the internet.

 I have found references on the internet to accesing params with @{param}
 instead of #{param} which I have also tried with no luck. I have also
 tried specifying paramaterType=map on the nested select with no
 results.

 ResultMap (XML file 1):
 resultMap id=myResultMap type=ResultClass
    id property=id column=id /
    id property=clientId column=client_id /
    result property=someProp column=some_prop /
    collection property=myList column={id=id,clientId=client_id}
 javaType=ArrayList ofType=MyType
 select=other.xml.namespace.MyTypeNS.nestedSelect /
 /resultMap

 Select (XML file 2):
 mapper namespace=other.xml.namespace.MyTypeNS
    resultMap id=myTypeResultMap type=MyType
         !-- mapping of MyType --
    /resultMap
    select id=nestedSelect parameterType=map
 resultMap=myTypeResultMap
        SELECT *
        FROM my_type_table
        WHERE other_id = #{id} AND client_id = #{client_id}
    /select
 /mapper

 Thanks for your time.
 Byron








 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator and enum colum type

2009-11-12 Thread Jeff Butler
Enum is not a standard JDBC type, so Ibator won't know what to do with it.

However, I just did a quick test and it works fine if you configure it
correctly.  Steps:

1. You will need to define the corresponding Java enum yourself (foo.bar.MyEnum)

2. Then do a column override in the Ibator configuration:

table name=someTable
  columnOverride column=someColumn javaType=foo.bar.MyEnum/
/table

This works as expected.  I've checked in a new test to prove it for the future.

Jeff Butler


2009/11/12 Tomáš Procházka t.procha...@centrum.cz:

 Another issue that I found in ibator is that he doesn't support Enum type 
 when database has enum column. It generate pojo object as String for this 
 field :-(
 Will be this supported?

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator for ibatis 3

2009-11-12 Thread Jeff Butler
Hi Guy,

I'm glad you are finding some value from Ibator.

I have no plans to do a generate from a select statement.  I'm not
opposed to it philosophically - I just have limited time right now.
Feel free to work on a patch if you are interested.

Jeff Butler


On Thu, Nov 12, 2009 at 1:34 AM, Guy Rouillier guyr-...@burntmail.com wrote:
 Jeff Butler wrote:

 Ibator updates for iBATIS3 are now in SVN.

 ...

 Let me know if you encounter any difficulties.

 Jeff, thanks for your work on this.  I've been using iBATIS 3 and Ibator
 1.2.2 on a new project and the capabilities are great!  I have one issue.
  Just yesterday, I had a complex SELECT statement I was trying to use.  I
 started typing up the result map by hand and that got tedious. So, I took
 the easy way out and in the database, did a CREATE TABLE AS SELECT... ; this
 is Oracle, btw.  That worked fine; I was then able to run Ibator against the
 table.

 My question is, with Ibator 3 will we be able to ask it to generate output
 based on a supplied SELECT statement?  Or is it still restricted to tables
 (and views)?  I took a quick look at the SVN repository online and the DTD
 still only shows table as the way to generate artifacts.

 Hmm, another thought.  I typed up the SELECT statement in the iBATIS mapper
 file after first testing it in Oracle.  I then started working on the result
 map.  Would it be possible to tell Ibator to use an iBATIS SQL statement ID
 as the source for generating artifacts?

 Thanks.

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: ibator and default column value

2009-11-09 Thread Jeff Butler
The generated insertSelective method is intended to help with default
values in fields - you can use this method to keep columns out of the
insert list so that the default value is used.  I understand that this
does not help you with getting those values back into the domain
object - you'll have to do a select for that.  Selecting the values
from the DB is the only reliable way to get the values back in all
cases.

As for incremental updates to existing code...base Ibator will do this
for XML files, but not Java files.  The Eclipse plugin supplies this
function for Java files, so you'll need to wait until the new version
of the Eclipse plugin comes out for that.  This has been discussed on
this list many times, so you can look back in the archives to
understand the reasons for this.

I'm glad Ibator worked for you with iBATIS3!

Jeff Butler


2009/11/9 Tomáš Procházka t.procha...@centrum.cz:

 Hi.

 I tested now new commit of ibator with iBatis support, it works great.

 I have only question. It's (or will be) possible generate also default value 
 to class fields, according to default value in DB? Some column has NULL, 
 another 0 or true/false. If new instance of domain class will be have default 
 value it's easier to insert it in to table.

 And it's possible something like incremental update od generated code? If I 
 add some new column to DB table? If I own query or methods to generated code 
 it will be lost during next generate.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator for ibatis 3

2009-11-08 Thread Jeff Butler
Ibator updates for iBATIS3 are now in SVN.  I won't do a formal
release for a few days as I need to update the docs, but feel free to
check it out and play with it.  Ibator is now built with Maven rather
than Ant, so you'll need to know how to do a Maven build.  All the
tests pass, but there might be some situations I've not anticipated.
Let me know if you encounter any difficulties.  The SVN link is here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/

Jeff Butler



On Thu, Nov 5, 2009 at 11:41 PM, Zach Visagie za...@ipay.co.za wrote:
 On Thu, 5 Nov 2009 09:44:48 -0600
 Jeff Butler jeffgbut...@gmail.com wrote:

 Ibator for ibatis3 has been *almost* ready for some time now.  I'll

 :)

 try to get it finished and checked in to SVN this weekend.


 Cool, thanks! In terms of our context as I described below, getting even a 
 buggy beta version is ok for our use...



 Jeff Butler


 On Thu, Nov 5, 2009 at 1:17 AM, Zach Visagie za...@ipay.co.za wrote:
  Hi
 
  My comment: I have had a first look at ibatis 3 and I like it a lot. Even 
  though annotations might not have lived up to the expected promise, we 
  certainly have some use cases for which they are going to be very handy. 
  Thanks for the good work guys! (I can soon retire my custom auto generated 
  keys hack for ibatis 2)
 
  My question: We have a new project we will be working on for the next 5-7 
  months and I want to start using ibatis 3 and ibator. Is there any ibator 
  code for ibatis 3 in svn that can be checked out or any binaries for a 
  current version of ibator that supports ibatis 3?
 
  thanks
  Zach
 
  -
  To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
  For additional commands, e-mail: user-java-h...@ibatis.apache.org
 
 

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBatis queryforList not working for dynamic Stored Proc

2009-11-02 Thread Jeff Butler
If I understand the question, it seems you are asking if ibatis
supports optional parameters for stored procedure calls. The simple
answer is yes.

See the if... tag with ibatis 3 or the isnotnull... tag with ibatis 2.

Jeff Butler


On 11/2/09, abdesai abhijit.de...@nomura.com wrote:

 Hi ppl,

 I am using iBatis to call a stored proc, which in turn calls 6 other stored
 procs, resulting in 7 resultSets.

 Everything was working fine earlier. Later, I changed the 2nd stored
 proc(SP) to take in an additional OPTIONAL variable, (declare @var int =
 null), and then, changed the SP to be dynamic i.e. it builds a where clause
 dynamically depending on @var variable.

 if @var is not null
 select @l_var =  and a.var =  + convert(varchar(20), @var)

 exec(select .
   from .
   where 1=1  + @l_var
 +  and ..
 )

 Does iBatis support such dynamic StoredProcs?

 This throws the following error:
 
 java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
   at java.util.ArrayList.RangeCheck(ArrayList.java:547)
   at java.util.ArrayList.get(ArrayList.java:322)
   at
 com.nomura.rdp.rdmgateway.dao.impl.OrganisationDaoImpl.findByRDMId(OrganisationDaoImpl.java:92)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at
 org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
   at
 com.nomura.rdp.rdmgateway.interceptor.PerformanceMonitorInterceptor.doPerformanceMonitor(PerformanceMonitorInterceptor.java:39)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
   at
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
   at
 org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at
 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy22.findByRDMId(Unknown Source)
   at
 com.nomura.rdp.rdmgateway.business.OrganisationBo.findByRDMId(OrganisationBo.java:68)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at
 org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at
 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy23.findByRDMId(Unknown Source)
   at
 com.nomura.rdp.rdmgateway.service.impl.OrganisationServiceImpl.findByRDMId(OrganisationServiceImpl.java:62)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke

Re: Update Table with selected columns

2009-10-22 Thread Jeff Butler
Ibator generates updateByPrimaryKey and updateByExample methods that
serve this purpose.

Jeff Butler


On Thu, Oct 22, 2009 at 2:26 PM, Vinaya Tirikkovalluru
vinaya.tirikkovall...@converge.com wrote:
 Hi,



 I am using Ibator to generate the Ibatis objects.

 I have a requirement where I should be able to create the SQL as



 Update table set a=1, b=2, c=3, …. Where clause/primary key



 Any one did get this to work with Ibator? I would like to modify the Ibator
 code if necessary



 Thanks

 Vinaya



 
 This electronic message is intended only for the use of the individual(s) or
 entity(ies) named above and may contain information which is privileged
 and/or confidential. If you are not the intended recipient, be aware that
 any disclosure, copying, distribution, dissemination or use of the contents
 of this message is prohibited. If you received this message in error, please
 notify the sender immediately.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Update Table with selected columns

2009-10-22 Thread Jeff Butler
updateByPrimaryKeySelective and updateByExampleSelective allow you to
select the columns - only non-null columns in the parameter objects
will be updated.

Jeff Butler


On Thu, Oct 22, 2009 at 2:31 PM, Vinaya Tirikkovalluru
vinaya.tirikkovall...@converge.com wrote:
 They do, they don't take the specified columns though.
 I need to update all the columns in the table.
 I don't want to do that. I would like to specify which columns I want to
 update, not all

 Thanks
 Vinaya




 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Thursday, October 22, 2009 3:29 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Update Table with selected columns

 Ibator generates updateByPrimaryKey and updateByExample methods that
 serve this purpose.

 Jeff Butler


 On Thu, Oct 22, 2009 at 2:26 PM, Vinaya Tirikkovalluru
 vinaya.tirikkovall...@converge.com wrote:
 Hi,



 I am using Ibator to generate the Ibatis objects.

 I have a requirement where I should be able to create the SQL as



 Update table set a=1, b=2, c=3,  Where clause/primary key



 Any one did get this to work with Ibator? I would like to modify the
 Ibator
 code if necessary



 Thanks

 Vinaya



 
 This electronic message is intended only for the use of the
 individual(s) or
 entity(ies) named above and may contain information which is
 privileged
 and/or confidential. If you are not the intended recipient, be aware
 that
 any disclosure, copying, distribution, dissemination or use of the
 contents
 of this message is prohibited. If you received this message in error,
 please
 notify the sender immediately.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 This electronic message is intended only for the use of the individual(s) or 
 entity(ies) named above and may contain information which is privileged 
 and/or confidential.  If you are not the intended recipient, be aware that 
 any disclosure, copying, distribution, dissemination or use of the contents 
 of this message is prohibited.  If you received this message in error, please 
 notify the sender immediately.

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBatis - Connections to PostgreSQL Not Closing

2009-10-19 Thread Jeff Butler
We should also see the Java code that creates the SqlMapClient.
Without Spring you need to make sure that only a SINGLE instance of
that object is created (it should be and stored either in a singleton
or something like a web context).

Jeff Butler

On Mon, Oct 19, 2009 at 2:50 PM, Larry Meadors larry.mead...@gmail.com wrote:
 Can you post the sqlmapconfig.xml?

 On Mon, Oct 19, 2009 at 1:44 PM, Jim Borland jborl...@calpoly.edu wrote:

 No, I'm not smart enough to use a DAO implementation (I've read a little
 about them).  Also, I keep reading about Spring -- a whole bunch of stuff on
 it comes up when I Google on these topics.  Someday I'm going to check into
 Spring.

 My situation is very simple and it seems like plain old iBatis ought to be
 plenty for me in this application.  iBatis is supposed to take care of all
 the background stuff and just let me write mapped statements.  I'm committed
 to making iBatis work without a bunch of extra stuff.  Thanks for your
 interest in my problem.


 Warren Bell-2 wrote:

 Are you using any DAO implementation ? Spring? Makes things much simpler.

 Warren

 Jim Borland wrote:
 I've been fighting this issue for a long time now and am quite
 frustrated.  I
 originally started out with just:

 -- artists = (ArrayList) sqlMap.queryForList(getArtistInfo, list ); --
 but was getting all these IDLE connections.  So I tried adding
 start/commit/end transaction statements surrounding the query.  Still
 getting IDLEs so then I tried using :

 -- session = sqlMap.openSession(); -- and letting the session
 start/commit/end the transaction.  Still got IDLEs.  That's when I
 tried
 creating, using and closing my own connection with the same sad result.

 One thing Rick Wellman said was especially interesting.  Every time you
 create an instance of SqlMapClient you create an entirely new connection
 pool.  I hadn't thought about that before.  I guess the bottom line is I
 don't really understand what is happening in a connection pool.  Still,
 my
 situation is so simple, yet the same bad outcome occurs no matter what I
 try.  Help!


 Rick.Wellman wrote:

 Since I have some time over lunch:
 1) I agree with Larry's reply below
 2) At the risk of embarrassing myself on this forum, see below for my
 reply to your comments and questions:

 [your-code-sample-was-here]
 [your-comments-were-here]
 I've been wrestling with this problem for a long time and right now
 there are three things about which I wonder:

 (1) All the code examples I've seen show the sqlMapClient being
 generated in the same try statement as the actual query. I'm creating it
 in a separate class and passing it to another class. Could this be a
 problem? I'm not sure why it would matter, but that is something unique
 about my situation.

 Usually, your entire application would share a single instance of

 SqlMapClient.  It matters in the sense that it is un-necessary and
 would, at a minimum, create an entirely new connection pool (see #3 for
 more)

 (2) In the above code I use the DataSource obtained from SqlMapClient --
 Is there something wrong with doing this?

 Well, probably... and it is un-necessary.  Use Larry's version. (i.e.

 the normal way to use the SqlMapClient)

 (3) Have I somehow mis-configured the connection pool?

 I could be wrong but I still highly suspect that the connections are

 a result of the connection pool and it seems to me that you're not
 understanding the purpose of a connection pool.  i.e. You're trying to
 explicitly open a connection with code.  The connection pool will
 usually expand and contract the number of connections to the database
 based on the load and its configuration (which is why it is called a
 pool).  You do not have direct control over which connection your
 iBatis SqlMapClient will use [nor do you probably want that].  I
 apologize in advance if I am way off base with this response; not my
 intent to offend, but rather educate.

 To the masses... in regards to my comment #3, is there an implementation
 of a pool which is not a pool at all but a single connection that
 someone can use to verify an instance like this?  Or maybe configure the
 pool to only have a size of one?  Just thinking out loud... I've never
 had reason to look into something like this but it seems like this
 question comes up every so often? (i.e. the question of connections
 opened via iBatis)

 -Original Message-
 From: Larry Meadors [mailto:larry.mead...@gmail.com]
 Sent: Monday, October 19, 2009 12:56 PM
 To: user-java@ibatis.apache.org
 Subject: Re: iBatis - Connections to PostgreSQL Not Closing

 This looks to me like you are *way* overcomplicating this. :-)

 The method should be more like this:

 public List getArtistInfo(){
   return sqlMap.queryForList(getArtistInfo, list);
 }

 Unless you have some really crazy wacky stuff going on, there should
 never be a need for you to deal with connections at that level.

 Also, what's the purpose of passing in 'list' as the second

Re: iBatis - Connections to PostgreSQL Not Closing

2009-10-19 Thread Jeff Butler
IIRC, Struts2 actions are not singletons.  So this code is creating a
new instance of the SqlMapClient (and it's associated connection pool)
each time you hit the web page.  They will eventually get cleaned up
by the GC, but that might take a while.

Better would be to implement ApplicationAware also, then write code like this:

SqlMapClient sqlMap = (SqlMapClient) applicationMap.get(sqlMap);
if (sqlMap == null) {
 try {
sqlMap =
SqlMapClientBuilder.buildSqlMapClient(Resources.getResourceAsReader(sqlMaps.xml));
   applicationMap.put(sqlMap, sqlMap);
 } catch (Exception e)  {
e.printStackTrace();
 }
}

Make sure all other actions use this same code - a good use for a
super class :).  Then you know it's only created once.

Jeff Butler




On Mon, Oct 19, 2009 at 3:28 PM, Jim Borland jborl...@calpoly.edu wrote:

 Here it is.  Thanks for your interest in my situation.  Using Apache Struts2
 - this is an action implementation.  The call is to listOfArtists in class
 ListSwingCatAction

 =

 public class ListSwingCatAction implements SessionAware
 {
   private SqlMapClient sqlMap;
   private SwingCatIBatisDBHandler myDBHandler;
   private Map sessionMap;

   public ListSwingCatAction()
   {
      try
      {
         sqlMap =
 SqlMapClientBuilder.buildSqlMapClient(Resources.getResourceAsReader(sqlMaps.xml));
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
      myDBHandler = new SwingCatIBatisDBHandler(sqlMap);
   }

   public String listOfArtists()
   {
      ArrayList artists = myDBHandler.getArtistInfo();
      sessionMap.put(artists, artists);
      return success;
   }
 }

 =


 Jeff Butler-2 wrote:

 We should also see the Java code that creates the SqlMapClient.
 Without Spring you need to make sure that only a SINGLE instance of
 that object is created (it should be and stored either in a singleton
 or something like a web context).

 Jeff Butler

 On Mon, Oct 19, 2009 at 2:50 PM, Larry Meadors larry.mead...@gmail.com
 wrote:
 Can you post the sqlmapconfig.xml?

 On Mon, Oct 19, 2009 at 1:44 PM, Jim Borland jborl...@calpoly.edu
 wrote:

 No, I'm not smart enough to use a DAO implementation (I've read a little
 about them).  Also, I keep reading about Spring -- a whole bunch of
 stuff on
 it comes up when I Google on these topics.  Someday I'm going to check
 into
 Spring.

 My situation is very simple and it seems like plain old iBatis ought to
 be
 plenty for me in this application.  iBatis is supposed to take care of
 all
 the background stuff and just let me write mapped statements.  I'm
 committed
 to making iBatis work without a bunch of extra stuff.  Thanks for your
 interest in my problem.


 Warren Bell-2 wrote:

 Are you using any DAO implementation ? Spring? Makes things much
 simpler.

 Warren

 Jim Borland wrote:
 I've been fighting this issue for a long time now and am quite
 frustrated.  I
 originally started out with just:

 -- artists = (ArrayList) sqlMap.queryForList(getArtistInfo, list );
 --
 but was getting all these IDLE connections.  So I tried adding
 start/commit/end transaction statements surrounding the query.  Still
 getting IDLEs so then I tried using :

 -- session = sqlMap.openSession(); -- and letting the session
 start/commit/end the transaction.  Still got IDLEs.  That's when I
 tried
 creating, using and closing my own connection with the same sad
 result.

 One thing Rick Wellman said was especially interesting.  Every time
 you
 create an instance of SqlMapClient you create an entirely new
 connection
 pool.  I hadn't thought about that before.  I guess the bottom line is
 I
 don't really understand what is happening in a connection pool.
  Still,
 my
 situation is so simple, yet the same bad outcome occurs no matter what
 I
 try.  Help!


 Rick.Wellman wrote:

 Since I have some time over lunch:
 1) I agree with Larry's reply below
 2) At the risk of embarrassing myself on this forum, see below for my
 reply to your comments and questions:

 [your-code-sample-was-here]
 [your-comments-were-here]
 I've been wrestling with this problem for a long time and right now
 there are three things about which I wonder:

 (1) All the code examples I've seen show the sqlMapClient being
 generated in the same try statement as the actual query. I'm creating
 it
 in a separate class and passing it to another class. Could this be a
 problem? I'm not sure why it would matter, but that is something
 unique
 about my situation.

 Usually, your entire application would share a single instance of

 SqlMapClient.  It matters in the sense that it is un-necessary and
 would, at a minimum, create an entirely new connection pool (see #3
 for
 more)

 (2) In the above code I use the DataSource obtained from SqlMapClient
 --
 Is there something wrong with doing this?

 Well, probably... and it is un-necessary.  Use Larry's version.
 (i.e.

 the normal way to use

Re: Executing PL/SQL procs from migration tool.

2009-10-19 Thread Jeff Butler
Can you configure the end of line delimiter?  If so, the user could
choose some unused character for this kind of situation.

Jeff Butler


On Mon, Oct 19, 2009 at 9:13 PM, Clinton Begin clinton.be...@gmail.com wrote:
 PS:  you could use full line demarcation and use 'GO' or something like SQL
 Server...
 But otherwise we'll need some creative thinking to figure out how to deal
 with the double ;
 Clinton

 On Mon, Oct 19, 2009 at 8:12 PM, Clinton Begin clinton.be...@gmail.com
 wrote:

 The double ; will cause problems.  I'm not sure how I would demarcate
 that... any ideas?

 On Mon, Oct 19, 2009 at 7:18 PM, camelContext
 praveen.krish...@citrix.com wrote:

 Hi All,

 I am using iBatis migration tool to create my service schema. My service
 schema demands that i execute couple of PL/SQL procedures for some
 permission related things  (post schema creation).

 I tried to execute the following from one of my scripts

 BEGIN
 oracle.grants.everything('SUBSCRIPTPKRISHNAN','SUBSCRIPTPKRISHNANAPP',
 TRUE);
 END;

 But when executing the migrate statement, i get the following error


 == Applying: 20091009120309_create_base_schema.sql
 =
 --  create base schema
 -- Migration SQL that makes the change goes here.
 --EXECUTE IMMEDIATE 'BEGIN
 oracle.grants.everything(\'SUBSCRIPTPKRISHNAN\',\'SUBSCRIPTPKRISHNAN\',
 TRUE) END'
 BEGIN
 oracle.grants.everything('SUBSCRIPTPKRISHNAN','SUBSCRIPTPKRISHNANAPP',
 TRUE)
 END
 Error executing: BEGIN
 oracle.grants.everything('SUBSCRIPTPKRISHNAN','SUBSCRIPTPKRISHNANAPP',
 TRUE)
 END .  Cause: java.sql.SQLException: ORA-06550: line 1, column 86:
 PLS-00103: Encountered the symbol END when expecting one of the
 following:

   := . ( % ;


 ERROR: Error executing command.  Cause:
 org.apache.ibatis.jdbc.RuntimeSqlException: Error executing: BEGIN
 oracle.grants.everything('SUBSCRIPTPKRISHNAN','SUBSCRIPTPKRISHNANAPP',
 TRUE)
 END .  Cause: java.sql.SQLException: ORA-06550: line 1, column 86:
 PLS-00103: Encountered the symbol END when expecting one of the
 following:

   := . ( % ;


 --
 View this message in context:
 http://www.nabble.com/Executing-PL-SQL-procs-from-migration-tool.-tp25967912p25967912.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Building iBator Eclipse plug-in from source

2009-09-16 Thread Jeff Butler
We reorganized SVN recently and I haven't gotten around to updating
all the documentation pointers yet.  Sorry for the confusion.

There's a page in the Eclipse documentation for Ibator that talks
about building the plugin here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html

Jeff Butler


On Wed, Sep 16, 2009 at 1:24 AM, Guy Rouillier guyr-...@burntmail.com wrote:
 I'm trying to build the iBator Eclipse plug-in from source to correct the
 NullPointerException if the daoGenerator clause is not present. I've got the
 trunk checked out.  BTW, both the website and the Eclipse help list the
 wrong URL for SVN checkout.  Both of them say to check out from

 http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/

 The actual URL is

 http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/

 Following the directions in the online help, I was able to rebuild the core
 component.  But how do I rebuild the eclipse component?

 Thanks.

 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Mapping new syntax

2009-09-08 Thread Jeff Butler
The old syntax is gone.  The new syntax is like this:

if test=someProperty != null
  ...
/if

iBATIS now uses OGNL for expressions - it's much more powerful than
the old tags.

Jeff Butler


On Tue, Sep 8, 2009 at 2:49 AM,
fareszfares.zgh...@ibs-softsolutions.com wrote:

 Does iBatis3 support the old syntax of iBatis 2 like isNotNull.../ if not
 so the migration from version 2 to 3 will affect all our mapping/queries
 definitions and will cause a big overhead for the company. Is there any
 possibility to migrate without doing all the changes listed, or is there any
 tool that will help us to minimize this overhead?
 --
 View this message in context: 
 http://www.nabble.com/Mapping-new-syntax-tp25341397p25341397.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Mapping new syntax

2009-09-08 Thread Jeff Butler
You have some options...

If iBATIS2 is working well for you, then you might decide to stay with it.

Otherwise, you could probably write an XSL transform that would do the
migration automatically.  You might spend less time writing the XSL
than on manually migrating the XML - and then you could contribute it
back to the community.

Jeff Butler

On Tue, Sep 8, 2009 at 7:36 AM,
fareszfares.zgh...@ibs-softsolutions.com wrote:

 Yes i know but we have a huge application with thousands of queries  :S
 So should we loose time by reconstructing all these queries???




 Jeff Butler-2 wrote:

 The old syntax is gone.  The new syntax is like this:

 if test=someProperty != null
   ...
 /if

 iBATIS now uses OGNL for expressions - it's much more powerful than
 the old tags.

 Jeff Butler


 On Tue, Sep 8, 2009 at 2:49 AM,
 fareszfares.zgh...@ibs-softsolutions.com wrote:

 Does iBatis3 support the old syntax of iBatis 2 like isNotNull.../ if
 not
 so the migration from version 2 to 3 will affect all our mapping/queries
 definitions and will cause a big overhead for the company. Is there any
 possibility to migrate without doing all the changes listed, or is there
 any
 tool that will help us to minimize this overhead?
 --
 View this message in context:
 http://www.nabble.com/Mapping-new-syntax-tp25341397p25341397.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 View this message in context: 
 http://www.nabble.com/Mapping-new-syntax-tp25341397p25345367.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Using the foreach statement in iBatis 3.0

2009-08-26 Thread Jeff Butler
The collection attribute of the foreach tag should the property of
the parameter object that holds the list of values.  From what's
below, iBATIS is expecting a public List getList() method in the
BAFselectByDateRange object.

Jeff Butler


On Wed, Aug 26, 2009 at 1:43 PM, Richard Bibbrichard.b...@aimhedge.com wrote:

 Hello

 I'm trying to do a select along the lines of

 select id=selectBackAdjFutureByDateRange
 parameterType=BAFselectByDateRange resultMap=results
                select rec_date, int_field,     data_value
                from back_adj_future
                where feed = #{feed}
                and instrument = #{instrument}
                and periodicity = #{periodicity}
                and     int_field in
                foreach item=item index=index collection=list open=(
 separator=, close=)
                        #{item}
                /foreach
                and rec_date ![CDATA[]] #{endDate}
                and rec_date ![CDATA[]] #{startDate}
                order by rec_date
 /select

 The trouble is the foreach statement doesn't seem to work. This is because
 I can't tell the statement which of piece of member data from parameterType
 the statement will use. (the manual seems to indicate that the List/Array
 should be the only parameter.

 Can someone point out what I'm doing wrong (if anything)?
 --
 View this message in context: 
 http://www.nabble.com/Using-the-foreach-statement-in-iBatis-3.0-tp25152935p25152935.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: iBATOR+iBATIS generation is successful, but test does not work.

2009-08-20 Thread Jeff Butler
You need to enable statement namespaces. See here for an example:

http://ibatis.apache.org/docs/tools/ibator/afterRunning.html

Jeff Butler


On Thu, Aug 20, 2009 at 3:04 AM, bhaab...@yandex.ru wrote:

 Hi,

 This is file ibatorConfig.xml:

 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE ibatorConfiguration PUBLIC -//Apache Software Foundation//DTD
 Apache iBATIS Ibator Configuration 1.0//EN
  http://ibatis.apache.org/dtd/ibator-config_1_0.dtd; 
 ibatorConfiguration 
  classPathEntry
 location=F:\C\Work\RuNetSoft\GUVD\AccGuvd\lib\ojdbc14.jar /
  ibatorContext id=OracleTables targetRuntime=Ibatis2Java5
    jdbcConnection driverClass=oracle.jdbc.driver.OracleDriver
      connectionURL=jdbc:oracle:thin:@ws-krylov:1521:GUVD
      userId=guvd_user password=sys /
    javaModelGenerator targetPackage=com.rns.guvd.model
      targetProject=AccGuvd/src /
    sqlMapGenerator targetPackage=com.rns.guvd.xml
      targetProject=AccGuvd/src /
    daoGenerator type=GENERIC-CI targetPackage=com.rns.guvd.dao
      targetProject=AccGuvd\src /
    table tableName=account_guvd
      property name=useActualColumnNames value=true/
    /table
  /ibatorContext
 /ibatorConfiguration

 Generate iBATIS Artifacts is successful, but the test does not work:

 public static void main(String[] args) throws SQLException {
                Reader reader = null;
                try {
                        reader =
 Resources.getResourceAsReader(com/rns/guvd/xml/ACCOUNT_GUVD_SqlMap.xml);
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                SqlMapClient client = SqlMapClientBuilder.buildSqlMapClient 
 (reader);
                AccountGuvdDAO dao = new AccountGuvdDAOImpl(client);
                AccountGuvd accountGuvd = dao.selectByPrimaryKey(new 
 BigDecimal(1));
                System.out.println(//--  + accountGuvd.toString());
        }

 Exception in thread main com.ibatis.sqlmap.client.SqlMapException: There
 is no statement named ACCOUNT_GUVD.ibatorgenerated_selectByPrimaryKey in
 this SqlMap.
        at
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
        at
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:509)
        at
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
        at
 com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
        at
 com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
        at
 com.rns.guvd.dao.AccountGuvdDAOImpl.selectByPrimaryKey(AccountGuvdDAOImpl.java:106)
        at com.rns.guvd.Test_AG.main(Test_AG.java:31)

 This is file generated ACCOUNT_GUVD_SqlMap.xml:

 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE sqlMap PUBLIC -//ibatis.apache.org//DTD SQL Map 2.0//EN
 http://ibatis.apache.org/dtd/sql-map-2.dtd; 
 sqlMap namespace=ACCOUNT_GUVD 
  resultMap id=ibatorgenerated_BaseResultMap
 class=com.rns.guvd.model.AccountGuvd 
    !--
      WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
    --
    result column=ID_GUVD property=ID_GUVD jdbcType=DECIMAL /
    result column=FIRST_NAME property=FIRST_NAME jdbcType=VARCHAR /
    result column=LAST_NAME property=LAST_NAME jdbcType=VARCHAR /
    result column=EMAIL property=EMAIL jdbcType=VARCHAR /
  /resultMap
  sql id=ibatorgenerated_Example_Where_Clause 
    !--
      WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
    --
    iterate property=oredCriteria conjunction=or prepend=where
 removeFirstPrepend=iterate 
      isEqual property=oredCriteria[].valid compareValue=true 
        (
        iterate prepend=and
 property=oredCriteria[].criteriaWithoutValue conjunction=and 
          $oredCriteria[].criteriaWithoutValue[]$
        /iterate
        iterate prepend=and
 property=oredCriteria[].criteriaWithSingleValue conjunction=and 
          $oredCriteria[].criteriaWithSingleValue[].condition$
            #oredCriteria[].criteriaWithSingleValue[].value#
        /iterate
        iterate prepend=and
 property=oredCriteria[].criteriaWithListValue conjunction=and 
          $oredCriteria[].criteriaWithListValue[].condition$
          iterate property=oredCriteria[].criteriaWithListValue[].values
 open=( close=) conjunction=, 
            #oredCriteria[].criteriaWithListValue[].values[]#
          /iterate
        /iterate
        iterate prepend=and
 property=oredCriteria[].criteriaWithBetweenValue conjunction=and 
          $oredCriteria[].criteriaWithBetweenValue[].condition$
          #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
          #oredCriteria[].criteriaWithBetweenValue

Re: iBATOR does not generate without optional an element daoGenerator

2009-08-20 Thread Jeff Butler
The code in SVN is very stable so you can check it out and build it
yourself to have the bug fix.  The only reason I haven't released a
new version of Ibator is that I'm writing the code generators for
iBATIS3.  Should be out very soon.

Jeff Butler


On Thu, Aug 20, 2009 at 3:14 AM, bhaab...@yandex.ru wrote:

 Hi Alexis


 Alexis Pigeon wrote:

 It's a known bug, fixed in SVN, but not in any stable release:
  https://issues.apache.org/jira/browse/IBATIS-607 

 HTH,
 alexis


 Thanks, i.e. without daoGenerator in any way it is impossible.

 Alexander
 --
 View this message in context: 
 http://www.nabble.com/iBATOR-does-not-generate-without-optional-an-element-%3CdaoGenerator%3E-tp25057307p25057835.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: How Do I Change Schema

2009-08-13 Thread Jeff Butler
You can't do this with a properties file.  You'll have to make
$schema$ a property of your parameter object.

At one point we talked about adding syntax for accessing properties in
SQL statements for iBATIS3, but it did not get implemented.  Then we
would have had something like this:

#{...} use bean properties as parameters
${...} use bean properties for string substitution
?{...} use system properties for string substitution

I don't remember if we thought this was too complex to implement, or
too confusing to use, or if we just forgot to do it.

Jeff Butler


On Thu, Aug 13, 2009 at 9:31 AM, pczurakczu...@wsinc.com wrote:

 I tried $schema$, but getting the following error.

 Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property
 named 'schema' in class 'com.wsinc.control.model.proddta.Control'; nested
 exception is com.ibatis.common.jdbc.exception.NestedSQLException:

 So it seems $schema$ should work, but I don't know where to define it, what
 file or what section.
 Would it go in the applicationContext.xml file, but what section?



 Clinton Begin wrote:

 Sorry... iBATIS 2...


 $schema$

 On Wed, Aug 12, 2009 at 10:57 PM, pczurak czu...@wsinc.com wrote:


 I did, but I get Syntax errors in my SQL statements, so iBATES does not
 understand ${schema}

 I don't know how or where to tell iBates to look in the properties file


 Clinton Begin wrote:
 
  Try the properties file you're using to configure the app... (specified
 in
  the properties... element)
 
  On Wed, Aug 12, 2009 at 10:48 PM, pczurak czu...@wsinc.com wrote:
 
 
  I've seen this post
  http://www.mail-archive.com/user-java@ibatis.apache.org/msg09212.html
  http://www.mail-archive.com/user-java@ibatis.apache.org/msg09212.html
 
 
  But it does not explain what file or where, so I though maybe someone
 in
  this forum would know.
 
 
 
  Clinton Begin wrote:
  
   I suggest you remove the specific schema and log in as the
 appropriate
   user
   and use the appropriate schema.  This can be specified in your JDBC
  URL.
  
   But if they're hard coded as you have below... then you're in for
 some
   Search and Replace.
  
   clinton
  
   On Wed, Aug 12, 2009 at 10:26 PM, pczurak czu...@wsinc.com wrote:
  
  
   I am using iBATIS 2.1
  
   My question is how do I change Schema name for DB2 database?
  
   Schema.tablename
  
   ex: Select * from TEST.Payroll Payroll where amount  100
   change to
   Select * from PRODUCTION.Payroll Payroll where amount  100
  
   What file and what parameters/properties do I have to change / add
 so
  I
   can
   change the schema without changing all of the XML files ?
  
  
   Thank You
  
  
   Peter
   --
   View this message in context:
  
 http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948645.html
   Sent from the iBATIS - User - Java mailing list archive at
 Nabble.com.
  
  
  
 -
   To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
   For additional commands, e-mail: user-java-h...@ibatis.apache.org
  
  
  
  
 
  --
  View this message in context:
  http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948782.html
  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
  For additional commands, e-mail: user-java-h...@ibatis.apache.org
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948843.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org





 --
 View this message in context: 
 http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24954424.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: How Do I Change Schema

2009-08-13 Thread Jeff Butler
I like it!

Jeff Butler

On Thu, Aug 13, 2009 at 10:02 AM, Clinton Beginclinton.be...@gmail.com wrote:
 Sorry for being unclear.  Jeff's explanation is correct.

 The reason I didn't put the property syntax in is that we need a way to
 specify whether the property should be parameterized, or just injected... so
 what I was thinking was maybe something like:

 #{env:prop_name} or something like that.  That way it could be a JDBC
 parameter, or a string like ${env:prop_name}

 Thoughts?
 Clinton

 On Thu, Aug 13, 2009 at 7:53 AM, Jeff Butler jeffgbut...@gmail.com wrote:

 You can't do this with a properties file.  You'll have to make
 $schema$ a property of your parameter object.

 At one point we talked about adding syntax for accessing properties in
 SQL statements for iBATIS3, but it did not get implemented.  Then we
 would have had something like this:

 #{...} use bean properties as parameters
 ${...} use bean properties for string substitution
 ?{...} use system properties for string substitution

 I don't remember if we thought this was too complex to implement, or
 too confusing to use, or if we just forgot to do it.

 Jeff Butler


 On Thu, Aug 13, 2009 at 9:31 AM, pczurakczu...@wsinc.com wrote:
 
  I tried $schema$, but getting the following error.
 
  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE
  property
  named 'schema' in class 'com.wsinc.control.model.proddta.Control';
  nested
  exception is com.ibatis.common.jdbc.exception.NestedSQLException:
 
  So it seems $schema$ should work, but I don't know where to define it,
  what
  file or what section.
  Would it go in the applicationContext.xml file, but what section?
 
 
 
  Clinton Begin wrote:
 
  Sorry... iBATIS 2...
 
 
  $schema$
 
  On Wed, Aug 12, 2009 at 10:57 PM, pczurak czu...@wsinc.com wrote:
 
 
  I did, but I get Syntax errors in my SQL statements, so iBATES does
  not
  understand ${schema}
 
  I don't know how or where to tell iBates to look in the properties
  file
 
 
  Clinton Begin wrote:
  
   Try the properties file you're using to configure the app...
   (specified
  in
   the properties... element)
  
   On Wed, Aug 12, 2009 at 10:48 PM, pczurak czu...@wsinc.com wrote:
  
  
   I've seen this post
  
   http://www.mail-archive.com/user-java@ibatis.apache.org/msg09212.html
  
   http://www.mail-archive.com/user-java@ibatis.apache.org/msg09212.html
  
  
   But it does not explain what file or where, so I though maybe
   someone
  in
   this forum would know.
  
  
  
   Clinton Begin wrote:
   
I suggest you remove the specific schema and log in as the
  appropriate
user
and use the appropriate schema.  This can be specified in your
JDBC
   URL.
   
But if they're hard coded as you have below... then you're in for
  some
Search and Replace.
   
clinton
   
On Wed, Aug 12, 2009 at 10:26 PM, pczurak czu...@wsinc.com
wrote:
   
   
I am using iBATIS 2.1
   
My question is how do I change Schema name for DB2 database?
   
Schema.tablename
   
ex: Select * from TEST.Payroll Payroll where amount  100
change to
Select * from PRODUCTION.Payroll Payroll where amount  100
   
What file and what parameters/properties do I have to change /
add
  so
   I
can
change the schema without changing all of the XML files ?
   
   
Thank You
   
   
Peter
--
View this message in context:
   
  http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948645.html
Sent from the iBATIS - User - Java mailing list archive at
  Nabble.com.
   
   
   
  -
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail:
user-java-h...@ibatis.apache.org
   
   
   
   
  
   --
   View this message in context:
  
   http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948782.html
   Sent from the iBATIS - User - Java mailing list archive at
   Nabble.com.
  
  
  
   -
   To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
   For additional commands, e-mail: user-java-h...@ibatis.apache.org
  
  
  
  
 
  --
  View this message in context:
  http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24948843.html
  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
  For additional commands, e-mail: user-java-h...@ibatis.apache.org
 
 
 
 
 
  --
  View this message in context:
  http://www.nabble.com/How-Do-I-Change-Schema-tp24948645p24954424.html
  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
  For additional commands

Re: [IB3] Some questions

2009-08-12 Thread Jeff Butler
Some answers...

String substitution is still there.  Use this: ${...}

The expression language is OGNL - OGNL is included basically as is in
iBATIS3.  iBATIS will make all bean properties available in the OGNL
context, and also the parameter object itself (as _parameter).  So
you can do if test=foo != null  or if test=_parameter.foo !=
null.

Jeff Butler



On Wed, Aug 12, 2009 at 7:22 PM, Zoran
Avtarovskizo...@sparecreative.com wrote:
 First off, fantastic effort guys. This looks like a unbelievable release.
 The improvements over the previous version are just incredible. I’m
 especially a fan of the new collection tag.

 I’ve been reading over the user guide and I have a couple of questions :

 In V2 and prior $value$ resulted in a string substitution while #value# used
 prepared statements and safe escaping. Is there still a string substitution
 option? I know it’s not recommended, but we do have cases where we need it.

 With regards to he expression language support in the dynamic sql tags, is
 OGNL being used to evaluate the test fields or a variation of EL? The reason
 I ask is that EL supports tests like NOT EMPTY while OGNL doesn’t. So “value
 != null” isn’t the same as “NOT EMPTY value”. Also the structure of the
 conditional tags follows the JSTL convention of choose, when, otherwise and
 not the more contemporary if, elseif, else. I guess the point I’m trying to
 make is that in a world where using multiple frameworks (struts, jsf, etc)
 is the norm, it might be a good idea that some of the conventions used in
 IB3 follow what’s been done in more established projects. For example if
 OGNL is used than I’d prefer to use if, elseif, else as that’s where my mind
 is and if I’m using EL then I go to the choose, when, otherwise. It may be
 just me, and I’m happy to concede that, but I find these little things
 really make a difference.

 Finally a question about Spring integration. One of the great selling points
 for iBatis has always been its tight spring integration. Is there any work
 going on at their end to integrate IB3 or is this something that we, the
 iBatis community, should be stepping up for?

 Again, a great release and I can’t wait to try it.

 Z.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Ibator: disable aliases for update and delete statements?

2009-08-09 Thread Jeff Butler
There's no support for this in Ibator now.  It will take a rewrite of
the example class generator at the very least - with support from new
SQL element generators too.

It also presents a bit of a usage problem for the iBATIS3 interface
mapper generator.  I haven't released this yet, but will soon.

So I'll have to think about this for a bit to come up with the best
way to deal with it.

Don't you love how standard SQL is?  I've never run into this in all
my testing, but I don't test with SQL Server regularly.  No problems
in MySql, HSQLDB, DB2, and (I think) PostgreSQL.

Jeff Butler



On Sun, Aug 9, 2009 at 10:11 AM, Chad McHenrymchen...@gmail.com wrote:
 Using SQL Server, I get syntax errors from Ibator generated deleteByExample
 and updateByExample* for tables which I give an alias.
 Neither deleteByPrimaryKey, updateByPrimaryKey, nor
 updateByPrimaryKeySelective use of the alias, and work, but deleteByExample,
 updateByExample, and updateByExampleSelective use the alias, and fail.
 I don't see a way to disable alias use in just the '*ByExample*' statements
 without creating Example_Where_Clause_Without_Aliases sql fragment, and
 using that instead of the Example_Where_Clause, but that would take a lot
 of rewriting of the auto generated stuff or an Ibator plugin.
 Any suggestions?
     table tableName=user alias=u delimitIdentifiers=true /

 generates:
   delete id=ibatorgenerated_deleteByPrimaryKey
 parameterClass=model.User
     !--
       WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
     --
     delete from user
     where id = #id:VARCHAR#
   /delete
   delete id=ibatorgenerated_deleteByExample
 parameterClass=model.UserExample
     !--
       WARNING - This element is automatically generated by Apache iBATIS
 ibator, do not modify.
     --
     delete user from user u
     include refid=user.ibatorgenerated_Example_Where_Clause /
   /delete
 deleteByPrimaryKey works fine, but deleteByExample fails with bad-syntax
 error, due to the aliases which SQLServer 2005 does not like in delete or
 update statements.



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: LazyLoading and CGLIB return wrong types

2009-07-29 Thread Jeff Butler
Are you really sure that lazy loading is buying you anything?  I think
people turn this on because it's theoretically cool, but I really
doubt its efficacy in so many cases.  It seems like turning it off
would solve all your issues - and maybe wouldn't have any noticeable
impact on your application performance.  It's worth a try.

Jeff Butler


On Wed, Jul 29, 2009 at 2:09 AM, Dawson Lewishardcore...@yahoo.com.br wrote:

 Hi,
 I am aware of that , but there are so many fields to exclude. It should not
 be that way .
 Plus it is really annoying to track all those classes iBatis is creating.

 Look at the following XML snippet xStream is producing
 addresses class=dynamic-proxy

 I may able of omitting fields but how do I get rid of the class attribute ?

 I tried type casting before serializing but it also does not work.

 Stelio

 cmathrusse wrote:

 XStream already has the capability to exclude specific fields from the
 serialization. It's rather easy:

 com.thoughtworks.xstream.XStream xstream;
 ...
 xstream.omitField(YouriBatisClass.class, fieldName);

 That's it! You can omit as many fields as you want.
 You can even omit them with Annotations but I don't think that would help
 much with CGLIB generated classes.

 Chris Mathrusse
 christopher.mathru...@sybase.com
 Sybase, Inc




 From:
 Clinton Begin clinton.be...@gmail.com
 To:
 user-java@ibatis.apache.org
 Date:
 07/28/2009 06:10 AM
 Subject:
 Re: LazyLoading and CGLIB return wrong types



 You'll have to paste it in, as attachements get stripped.

 I think I've seen it before though, a bunch of $adfweragvav type fields.
 I wish there was a way in XStream to ignore fields that start with $ or
 something.  You'd have the same problem with any framework that uses CGLIB
 or ASM etc.

 I've heard that Betwixt might be a good alternative to XStream in this
 regard.  Or you could try modifying XStream to ignore $ fields and subit a
 patch back to them.

 Cheers,
 Clinton

 On Tue, Jul 28, 2009 at 2:35 AM, Dawson Lewis hardcore...@yahoo.com.br
 wrote:

 Hi,
 It is what I am doing , I am using xStream 1.3  for serializing , I was
 using the 1.3.1 version before but it could not serialize synchronized
 collections , then I switch to 1.3. It seems that xStream is also
 serializing those objects created by iBatis at runtime . Have a look at
 the
 xml file generated by xStream , see how much garbage (meaning no
 disrespect for either iBatis or xStream because I love them both) is being
 added.

 I do not want to serialize  these iBatis enhanced objects  .

 Regards,
 Stelio


 Have you tried serializing to XStream or another alternative, instead of
 using Java's serialization?  While this is a limitation of iBATI 2
 (version
 3 solves it somewhat, but still not between systems), you should never
 depend on Java serialization for connecting two systems.  You should
 choose
 a more canonical serialization process.  XStream is my personal favourite,
 but there are many others (even some binary).

 Java serialization is a bad thing to depend upon.

 Cheers,
 Clinton

 --
 View this message in context:
 http://www.nabble.com/LazyLoading-and-CGLIB-return-wrong-types-tp24607048p24694842.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org






 --
 View this message in context: 
 http://www.nabble.com/LazyLoading-and-CGLIB-return-wrong-types-tp24607048p24713673.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Questions regd ibatis best practices - need some help here

2009-07-24 Thread Jeff Butler
iBATIS 3 is in development and is not formally released yet.  However,
I can vouch that it is nearly function complete and pretty stable.
You can check it out from Subversion and build it with Maven if you're
interested in trying it.  Here's the SVN link:

http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/

BTW - there's no published documentation yet - so look to the test
cases to see how to use it.

Jeff Butler



On Fri, Jul 24, 2009 at 12:38 AM, swaroop belurswaroop.be...@gmail.com wrote:


 Hi Jeff

 This is really good.  This kind of reply will really help us developers to
 use ibatis in correct way.
 I was struggling for couple of weeks to use ibatis the right way.

 Right now i can see the download link for ibatis  2.3.4 . May i know when
 ibatis 3 can be downloaded.

 Thanks for your time.

 -swaroop




 swaroop belur wrote:

 Hello all,

 Is there any pointer/link or document which suggests using certain
 features over others to achieve the same goal
 to improve performance for example.

 1. Like for instance when executing an update query , we can either
 specify parameterClass or parameterMap
 Which one is preferred  and why?

 2. Related to above - The cost of reflection while marshalling results.
     eg. For  [1]  is there any relation to reflection or both are same

 3. I was using ibator to generate some code today and observed by default
 it does NOT generate any paramterMaps
 Any reason for this. I hope this is the right forum to ask this
 question.It generates paramterClass where requied and no maps

 4. Also  is there any disadvantage  of using java.util.Map for providing
 parameters instead of a Java Bean. Again any demerits
 over using bean?

 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
 I did search for best practices in this forum - but
 was not convinced i found answers to my questions.

 I am trying to understand how much better from both developing and
 performance point will Spring-Ibatis integration
 be better than Spring-JDBC integration

 Really appreciate any response.

 Thanks
 sbelur








 --
 View this message in context: 
 http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24638908.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Questions regd ibatis best practices - need some help here

2009-07-24 Thread Jeff Butler
You don't need a parameter map for procedures in iBATIS2.  This is
from the developers guide, page 30:

procedure id=“callProcedure” parameterClass=”com.mydomain.MyParameter”
{call MyProcedure (#parm1,jdbcType=INTEGER,mode=IN#,
   #parm2,jdbcType=INTEGER,mode=IN#,
   #parm3,jdbcType=DECIMAL,mode=OUT,numericScale=2#)}
/procedure

Similar in iBATIS3.

Jeff Butler


2009/7/24 Andrey Rogov konu...@gmail.com:
 Jeff,
 If Map parameter will be deprecated,
 how we can run stored procedures in 3x version ?

 -Original Message-
 From: Jeff Butler [mailto:jeffgbut...@gmail.com]
 Sent: Friday, July 24, 2009 7:05 PM
 To: user-java@ibatis.apache.org
 Subject: Re: Questions regd ibatis best practices - need some help here

 iBATIS 3 is in development and is not formally released yet.  However,
 I can vouch that it is nearly function complete and pretty stable.
 You can check it out from Subversion and build it with Maven if you're
 interested in trying it.  Here's the SVN link:

 http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-3/

 BTW - there's no published documentation yet - so look to the test
 cases to see how to use it.

 Jeff Butler



 On Fri, Jul 24, 2009 at 12:38 AM, swaroop belurswaroop.be...@gmail.com
 wrote:


 Hi Jeff

 This is really good.  This kind of reply will really help us developers to
 use ibatis in correct way.
 I was struggling for couple of weeks to use ibatis the right way.

 Right now i can see the download link for ibatis  2.3.4 . May i know when
 ibatis 3 can be downloaded.

 Thanks for your time.

 -swaroop




 swaroop belur wrote:

 Hello all,

 Is there any pointer/link or document which suggests using certain
 features over others to achieve the same goal
 to improve performance for example.

 1. Like for instance when executing an update query , we can either
 specify parameterClass or parameterMap
 Which one is preferred  and why?

 2. Related to above - The cost of reflection while marshalling results.
     eg. For  [1]  is there any relation to reflection or both are same

 3. I was using ibator to generate some code today and observed by default
 it does NOT generate any paramterMaps
 Any reason for this. I hope this is the right forum to ask this
 question.It generates paramterClass where requied and no maps

 4. Also  is there any disadvantage  of using java.util.Map for providing
 parameters instead of a Java Bean. Again any demerits
 over using bean?

 5. Last - I am new and learning ibatis - is there any Best Practice FAQ .
 I did search for best practices in this forum - but
 was not convinced i found answers to my questions.

 I am trying to understand how much better from both developing and
 performance point will Spring-Ibatis integration
 be better than Spring-JDBC integration

 Really appreciate any response.

 Thanks
 sbelur








 --
 View this message in context:
 http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-
 here-tp24606061p24638908.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Questions regd ibatis best practices - need some help here

2009-07-23 Thread Jeff Butler
1. I prefer parameterClass - I think it is much easier to
maintain/read.  And note that parameterMap is deprecated in iBATIS 3.

2. There should be very little difference - with parameterClass iBATIS
generates a parameterMap at startup.

3. See  #1

4. There is a theoretical performance hit from using maps as
parameters rather than a JavaBean.  But it is so insignificant that
it's nothing to worry about.

5. There's no best practices FAQ currently - maybe it would be a good
idea to start one.  Here's are some thoughts (these are my opinions
only):

- Make sure there is only one instance of the SqlMapClient - put it in
a singleton, or a Spring container, or a web container's application
scope (this is not just opinion - you should definitely do this)
- Avoid parameterMaps (optional in iBATIS2, deprecated in iBATIS3)
- Use statement namespaces (optional in iBATIS2, required in iBATIS3)
- Keep things simple - use simple getters/setters for all properties
in JavaBeans
- Keep things simple - do not get caught up in using sql fragments
to avoid rewriting common SQL phrases - favor readability.  It's SQL -
not Java code!
- Ignore all iBATIS2 settings related to maxSessions, maxTransactions,
maxRequests.  These no longer have any effect in iBATIS2 and are
removed in iBATIS3
- Be skeptical about the benefits of lazy loading.  This is a
seductive feature, but probably has little measurable benefit in most
real world applications.
- Understand and utilize the transactional environment of your container
- Understand SQL optimization.  Any performance issues are far more
likely to be related to poor SQL performance than any issue with
iBATIS.
- Do not use the deprecated iBATIS DAO framework - use Spring instead
- Understand what iBATIS caching really does - iBATIS caches
statements, not objects or tables

Anybody have others?


Jeff Butler




On Wed, Jul 22, 2009 at 8:13 AM, swaroop belurswaroop.be...@gmail.com wrote:

 Hello all,

 Is there any pointer/link or document which suggests using certain features
 over others to achieve the same goal
 to improve performance for example.

 1. Like for instance when executing an update query , we can either specify
 parameterClass or parameterMap
 Which one is preferred  and why?

 2. Related to above - The cost of reflection while marshalling results.
    eg. For  [1]  is there any relation to reflection or both are same

 3. I was using ibator to generate some code today and observed by default it
 does NOT generate any paramterMaps
 Any reason for this. I hope this is the right forum to ask this question.It
 generates paramterClass where requied and no maps

 4. Also  is there any disadvantage  of using java.util.Map for providing
 parameters instead of a Java Bean. Again any demerits
 over using bean?

 5. Last - I am new and learning ibatis - is there any Best Practice FAQ . I
 did search for best practices in this forum - but
 was not convinced i found answers to my questions.

 I am trying to understand how much better from both developing and
 performance point will Spring-Ibatis integration
 be better than Spring-JDBC integration

 Really appreciate any response.

 Thanks
 sbelur






 --
 View this message in context: 
 http://www.nabble.com/Questions-regd-ibatis-best-practices---need-some-help-here-tp24606061p24606061.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Abator generated classes and MVC

2009-07-22 Thread Jeff Butler
My opinion, and it is just opinion, is that Account and AccountExample
are *sort of* like model classes (although Account suffers from the
anemic domain model disease).  AccountDAO and AccountDAOImpl are
service classes - to be used by the controller layer.  Ultimately, my
view is that these are all utility classes to be used by the real MVC
classes in your app.

If you forego iBATIS in the future, then AccountExample will be of
little use to you - it is very coupled to iBATIS.

Jeff Butler



On Wed, Jul 22, 2009 at 11:03 AM, Vinaya
Tirikkovalluruvinaya.tirikkovall...@converge.com wrote:
 Hi,

 I am using iBatis in my application with JSF and Spring.



 We are using ABator to generate the objects based on the database objects.



 For example….



 Account table will have

     Account.java

     AccountExample.java

     AccountDAO.java

     AccountDAOImpl.java

 I understand that DAO and DAOImpl will be for Model layer.

 Where do Account and AccountExample belong?



 Right now I have AccountBean.java in the view layer which is a copy of
 Account.java with additional properties.

 Can I move the Account.java and AccountExample.java to the view Layer?



 In case I forego iBatis in future… can I still use AccountExample with just
 modifying the DAO? Or does AccountExample is specific to Model layer too?

 I think we can have Account.java in view layer as it is a representation of
 the table like, DTO.



 Any ideas?



 Thanks

 Vinaya

 
 This electronic message is intended only for the use of the individual(s) or
 entity(ies) named above and may contain information which is privileged
 and/or confidential. If you are not the intended recipient, be aware that
 any disclosure, copying, distribution, dissemination or use of the contents
 of this message is prohibited. If you received this message in error, please
 notify the sender immediately.

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Sorting problem

2009-07-15 Thread Jeff Butler
I don't think you can send the order by clause as a prepared statement
parameter.  You should try string substitution instead.  Also, you
don't need the dynamic tag here:

isNotNull property=sort
  order by $sort$ $sortAsc$
/isNotNull

Jeff Butler

On Wed, Jul 15, 2009 at 9:08 AM, Linda van der
Pallvd...@heritageagenturen.nl wrote:
 Hello,

 Can anybody tell me what I'm doing wrong? I want my query to return a sorted
 list.

 Here are the relevant parts from my boek_SqlMap.xml (which is included in
 SqlMapConfig.xml)

 resultMap class=nl.lunaris.bookdb.model.database.Book id=BoekResultMap
  result column=ISBN jdbcType=VARCHAR property=isbn /
  result column=Titel jdbcType=VARCHAR property=title /
  result column=Uitgever jdbcType=INTEGER property=publisher /
  result column=Subgenre jdbcType=INTEGER property=subgenre /
  result column=Taal jdbcType=INTEGER property=language /
  result column=Beschrijving jdbcType=LONGVARCHAR property=description
 /
  result property=authors resultMap=boek.Auteurlijst /
 /resultMap

 resultMap class=nl.lunaris.bookdb.model.database.BookHasAuthorKey
 id=Auteurlijst
    result column=AUTEUR_ID jdbcType=INTEGER property=id /
    result column=ISBN jdbcType=VARCHAR property=isbn /
 /resultMap

 select id=selectSelective
 parameterClass=nl.lunaris.bookdb.model.frontend.SearchCriteria
 resultMap=BoekResultMap
    select b.ISBN, b.Titel, b.Uitgever, b.Subgenre, b.Taal, b.Beschrijving,
 a.ID as AUTEUR_ID
    from boek b
    join boek_has_auteur a ON b.ISBN = a.ISBN
    join boek_exemplaar e on b.ISBN = e.ISBN
  dynamic prepend=where 
    isNotNull prepend=AND property=isbn
      b.ISBN = #isbn:VARCHAR#
    /isNotNull
    isNotNull prepend=AND property=owner
      e.eigenaar = #owner:INTEGER#
    /isNotNull
    isNotNull prepend=AND property=publisher
      b.Uitgever = #publisher.id:INTEGER#
    /isNotNull
    isNotNull prepend=AND property=subgenre
      b.Subgenre = #subgenre.id:INTEGER#
    /isNotNull
    isNotNull prepend=AND property=language
      b.Taal = #language.id:INTEGER#
    /isNotNull
    isNotNull prepend=AND property=authors
      a.ID = #authors.id:INTEGER#
    /isNotNull
  /dynamic
  dynamic prepend=order by 
    isNotNull property=sort
      #sort:VARCHAR# #sortAsc:VARCHAR#
    /isNotNull
  /dynamic
 /select


 And here is the code I am calling it with:
 List result = sqlMapClient.queryForList(boek.selectSelective, key);


 I can see in my logging that the query is called and filled with the right
 parameters:
 2009-07-15 15:14:50,299 DEBUG [PreparedStatement] {pstm-100019} Executing
 Statement:     select b.ISBN, b.Titel, b.Uitgever, b.Subgenre, b.Taal,
 b.Beschrijving, a.ID as AUTEUR_ID    from boek b    join boek_has_auteur a
 ON b.ISBN = a.ISBN    join boek_exemplaar e on b.ISBN = e.ISBN     where
                    e.eigenaar = ?
   order by                 ? ?              2009-07-15 15:14:50,299 DEBUG
 [PreparedStatement] {pstm-100019} Parameters: [1, titel, asc]

 Regards,
 Linda van der Pal


 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org



-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: Force cache refresh + precaching

2009-07-15 Thread Jeff Butler
Why not just execute the query in some startup process, this would
prime the cache?  In a web app you could do it in a context listener.
Easy.


Jeff Butler

On Wed, Jul 15, 2009 at 3:34 PM, Sundar Sankarfatboys...@gmail.com wrote:
 I havent implemented this particular case, but I wud have to suggest you go
 with other technologies in conjunction, maybe comet or something like that.
 Am not sure if hibernate / hibernate cache handles this case but i wud look
 to check up with their dev team too.

 On Wed, Jul 15, 2009 at 1:25 PM, Vinaya Tirikkovalluru
 vinaya.tirikkovall...@converge.com wrote:

 Is there a specific reason why do you want to do that?

 Because, the first time you access the object, it will be created and
 stored in cache







 

 From: Anindya Mukherjee [mailto:anindya.mukher...@gmail.com]
 Sent: Wednesday, July 15, 2009 3:28 PM

 To: user-java@ibatis.apache.org
 Subject: RE: Force cache refresh + precaching



 Hi Vinaya,



 Thanks a lot for the help. I actually meant during app load ( when our
 application is booting ).



 -  Anindya



 From: Vinaya Tirikkovalluru [mailto:vinaya.tirikkovall...@converge.com]
 Sent: July-16-09 12:41 AM
 To: user-java@ibatis.apache.org
 Subject: RE: Force cache refresh + precaching



 Hi,



 What do you mean by before app load?



 To forcefully refresh the cache, you can use



 getSqlMapClient().flushDataCache(sqlmap.queryname);



 Vinaya



 

 From: Anindya Mukherjee [mailto:anindya.mukher...@gmail.com]
 Sent: Wednesday, July 15, 2009 3:06 PM
 To: user-java@ibatis.apache.org
 Cc: anindya.mukher...@gmail.com
 Subject: Force cache refresh + precaching



 Hi ,



 We have started using iBatis caches. To start with we are using an LRU
 cache. However we have an issue ,  the underlying tables in our db can be
 updated by manual inserts ( it is a shared db used by a number of apps ).



 Now we need a mechanism whereby we can forcefully refresh the iBatis
 cache. Can anybody help us with this ? Also the ibatis caches are lazy
 loading ( it loads on demand ) , is it possible to somehow precache some
 data during app load.



 -  Thanks,

 -  Anindya

 

 This electronic message is intended only for the use of the individual(s)
 or entity(ies) named above and may contain information which is privileged
 and/or confidential. If you are not the intended recipient, be aware that
 any disclosure, copying, distribution, dissemination or use of the contents
 of this message is prohibited. If you received this message in error, please
 notify the sender immediately.

 
 This electronic message is intended only for the use of the individual(s)
 or entity(ies) named above and may contain information which is privileged
 and/or confidential. If you are not the intended recipient, be aware that
 any disclosure, copying, distribution, dissemination or use of the contents
 of this message is prohibited. If you received this message in error, please
 notify the sender immediately.


 --
 Regards
 Sundar S.


-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: error fetching BLOB and CLOB data

2009-07-14 Thread Jeff Butler
Where in the iBATIS code is this happening?  You haven't given us much to go
on - perhaps an abbreviated stack trace would be in order?
Jeff Butler

On Tue, Jul 14, 2009 at 8:58 AM, Pat Thatte pat4...@hotmail.com wrote:

  Thanks Mario. We are using a CLI-based Type 2 JDBC Driver which uses
 jdbc 2.0.

 We eliminated the driver as an issue, as I mentioned in my question, by
 using the same datasource with straight SQL. We were able to successfully
 fetch BLOB and CLOB with straight SQL instead of iBATIS.

 Any other suggestions would be appreciated.


  Subject: Re: error fetching BLOB and CLOB data
 
  Pat,
 
  looks like you are using a very old version of the DB2 JDBC driver
 (atleast
  in the iBatis use-case u have detailed below)
  a - which is not a type 4 JDBC driver
  b - is a JDBC v1 driver.
 
  The versions of DB2 i have seen, dont even ship with that JDBC driver
  anymore. However here is a link that should be describing your env and
 what
  u need to do - http://www-01.ibm.com/support/docview.wss?uid=swg21081165
 
 
  Mario
 
 
 ---
 
  Pat Thatte
 
  Subject : error fetching BLOB and CLOB data
 
 
  We have BLOBs and CLOBs in a DB2 v8 database. We use a jdbcType of 'BLOB'
  or 'CLOB' respectively in our SQL Map file and are getting an error
  'CLI0123E SQL data type out of range. SQLSTATE=HY004'.
 
  There was an older post about checking the driver type, but we are able
 to
  fetch the data with the same DataSource using straight SQL.
 
  What else could we look at?
 
  Thanks,
  Pat.



  1   2   3   4   5   6   7   8   9   10   >