Re: Transaction Rollback not working with iBatis + Spring
You don't need the batch, and I'm pretty sure it won't ever work with the batch because the inserts don't happen when you call them (they happen when you call executeBatch()) so your ids don't get set when you expect them to. Remove the lines related to the batch, and I think it'll work. Larry On Wed, Jul 21, 2010 at 10:19 AM, Bruno Issenmann b.issenm...@labsoft.fr wrote: Hi, I'm facing the same problem. Did you solved it ? Thanks - 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: Passing Oracle Table Types (Is it possible?)
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Lazy Loading per ResultMap
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: SQLMap Question - Select Statement
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Select from View (as opposed to table) using iBatis
Are you connecting as the same use that your code is connecting as? The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: iBATIS 3 dynamic sql 'foreach' list got problem.
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: iBatis 3: dynamic sql and numeric property type problem
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Cause: java.sql.SQLException: Closed Connection
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: JPetstore5.0+mysql error:XXXX in field list is ambiguous
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Possible to get ibatis to throw an exception if not all params are filled in?
The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Mapping an Array of String
FYI: The ibatis project has moved and been renamed. It is no longer being maintained as an Apache project, but has moved (along with the development team) here: http://www.mybatis.org/ Please join us at the new location by joining the mailing list here: http://groups.google.com/group/mybatis-user Larry On Tue, Jun 1, 2010 at 8:14 AM, Mr.Squirrel francois.alb...@univ-nantes.fr wrote: hello, i am calling an oracle stored procedure which return the type TABLE OF VARCHAR2 (as output parameter) How can i map this type to the java type String [] ? SqlMap.xml : parameterMap id=calculDroits class=CalculDroits parameter property=seqFormation jdbcType=ARRAY javaType=java.lang.String[] mode=OUT / /parameterMap procedure id=pCalculDroits parameterMap=calculDroits { call pbw_calculDroitsReins.Du(?) } /procedure JavaBean CalculDroits.java : public class CalculDroits implements Serializable{ private static final long serialVersionUID = 9014779368033647012L; private String[] codesDroit; public String[] getCodesDroit() { return codesDroit; } public void setCodesDroit(String[] codesDroit) { this.codesDroit = codesDroit; } } Thank you -- View this message in context: http://old.nabble.com/Mapping-an-Array-of-String-tp28742440p28742440.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: iBatis 3: dynamic sql and numeric property type problem
I think you can just say if test=id != -1, but I haven't done this exact thing yet. Since we're using ognl for expressions, here's where I'd look: http://www.opensymphony.com/ognl/html/LanguageGuide/index.html Also, you should join and post to the new list at google: http://groups.google.com/group/mybatis-user instead. At this point, there are no plans to continue the ibatis project at Apache, the project (including the development team) has moved and it will live on as mybatis at google code instead. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: iBATIS with Java, SQL Server 2008
It's super easy - I use the freetds jdbc driver and it just works. However, use mybatis instead: http://www.mybatis.org/ The entire ibatis development team has moved there instead of remaining with the ASF due to technological issues and philosophical differences. :) Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: resultType=list contains null values
You want resultType to be a bean or map or maybe even integer - list will give you a list of lists, which is *not* what you want. :) Larry On Thu, May 20, 2010 at 4:57 AM, JohannesK johannes.kuus...@eficode.fi wrote: Hello I am having the weirdest problem with Ibatis 3. Here is my mapper XML: select id=verify resultType=list SELECT table_name.id_column FROM table_name WHERE table_name.other_column = #{parameter_id} AND table_name.id_column IN foreach item=id index=index collection=parameter_ids open=( separator=, close=) #{id} /foreach /select Mapper Java looks like this: public List verify( �...@param(parameter_id) Long customerId, �...@param(parameter_ids) Long... ids); The log tells me this: 13:48:11 DEBUG [Slf4jImpl] - == Executing: SELECT table_name.id_column FROM table_name WHERE table_name.other_column = ? AND table_name.id_column IN ( ? , ? ) 13:48:11 DEBUG [Slf4jImpl] - == Parameters: 1(Long), 71(Long), 78(Long) 13:48:11 DEBUG [Slf4jImpl] - == Columns: id_column 13:48:11 DEBUG [Slf4jImpl] - == Row: 71 13:48:11 DEBUG [Slf4jImpl] - == Row: 78 13:48:11 DEBUG [Slf4jImpl] - xxx Connection Closed The query seems to be in order and the result (based on the log) is the right one. However, the resulting List that I receive from the mapper contains two null values instead. Anyone have any ideas what's going on here? table and column names have been replaced, please excuse any mistakes -- View this message in context: http://old.nabble.com/resultType%3D%22list%22-contains-null-values-tp28619664p28619664.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: ibatis3 : multiple parameters in statement without map or bean
Yes, you have to annotate the parameters (because java reflection is kinda weak). It's in the user guide. Larry On Mon, May 17, 2010 at 4:15 AM, Nicolas ANTONIAZZI nicolas.antonia...@gmail.com wrote: Hi, Is it possible to pass multiple parameters in iBatis3 without having to pass a map or a bean ? example : - UserMapper.xml select id=selectUsers parameterType=hashmap resultType=ListUser SELECT * FROM user OFFSET #{offset} LIMIT #{limit} /select - UserMapper.java --- public interface UserMapper { public ListUser selectUsers(HashMapString, Integer parameters); } - Now, I can call my statement with : int offset = 10; int limit = 10; UserMapper userMapper = session.getMapper(UserMapper.class); HashMapString, Integer parameters = new HashMapString, Integer(); parameters.put(offset, offset); parameters.put(limit, limit); ListQuestion selections = questionMapper.selectQuestions(parameters); -- I think that a cleaner way would be to do somethink like : public interface UserMapper { public ListUser selectUsers(int offset, int limit); } UserMapper userMapper = session.getMapper(UserMapper.class); ListQuestion selections = questionMapper.selectQuestions(10, 10); --- Is there such a method to achieve it with iBatis 3 ? Thanks, Nicolas ANTONIAZZI. - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: xml persistence
No. On Thu, May 13, 2010 at 4:30 AM, Zhong Nanhai higerinbeij...@gmail.com wrote: Hi, Does iBatis support XML persistence, i.e. take an XML file as a database? Best Regards, Zhong Nanhai - 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: Way to use sql in mapper interface, without having to create a corresponding xml mapping file?
He wants to represent that in the xml config. Larry On Thu, May 13, 2010 at 2:35 PM, Jeff Butler jeffgbut...@gmail.com wrote: 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 - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Injecting an iBatis DAO
Yes. On Fri, May 7, 2010 at 7:29 AM, Giorgio Vespucci giorgio.vespu...@gmail.com wrote: Hi all My question is about if an iBatis Dao can be injected in a non-DAO class to use its services. Can I write so? pre public SomeThing methodOfNonDaoClass() { try { dao.startTransaction(); dao.startBatch(); some non-dao work on myData dao.insert(myData); for() { dao.update() } dao.executeBatch(); dao.commitTransaction(); } catch (Exception e) { e.printStackTrace(); } finally{ try { dao.endTransaction(); } catch (SQLException e) { e.printStackTrace(); } } return someThing; } /pre The dao instance has been injected in NonDaoClass after construction. The big question is if the transactional context works also I am not in the DAO code. Thank you all -- Giorgio Vespucci giorgio [dot] vespucci [at] gmail [dot] com Skype, Twitter, Slideshare: gvespucci Linux User #471792 http://xpermanwalking.blogspot.com - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Injecting an iBatis DAO
On Fri, May 7, 2010 at 8:21 PM, Maciej Radochonski mradochon...@gmail.com wrote: From technical point of view it is ok, but I would suggest to keep all the database related code in DAO class, because what are you doing here is mixing two layers that should be kept separate, BO and DAO. I couldn't disagree more. :) I think it's totally OK to put transactional logic outside of the data access layer - it keeps the data access code simpler, and it's still trivial to unit test with mocks. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Specify more than one parameter in select statement without using deprecated parameterMap
Pass a bean or Map with those attributes, and you should be good to go. On Wed, May 5, 2010 at 2:17 AM, Thomas Mair thomas.mai...@googlemail.com wrote: Hi, i am just starting to play with iBatis 3 and can not figure out how to declare more than one parameter in a select statement in XML without using the parameterMap attribute. I figured how it works with annotations, but I would like to do everything in XML. My select statement looks like this: SELECT delta, start_value AS startValue, timestamp FROM Effect WHERE action_type = #{typeId} AND action_id = #{id} Thanks Thomas - 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.
Hm, odd - I've done this hundreds of times with oracle - just passing a Date object. Send the relevant code. Larry On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin jeremy.jar...@gmail.com wrote: Hi, I'm simply trying to build a request with Date comparaisons.. and ibatis still reply me empty list.. My generated request in logs : DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-10} Connection DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-10} Preparing Statement: select * from TAB_CHIF where (DAT_CHIF ?)order by DAT_CHIF DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-11} Executing Statement: select * from TAB_CHIF where (DAT_CHIF ?)order by DAT_CHIF DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-11} Parameters: [2010-05-04] DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-11} Types: [java.sql.Date] If I launch handly the same request (with a date parsing) in my oracle client, there's one row. select * from TAB_CHIF where(DAT_CHIF to_date('2010-05-04', '-MM-dd')); I guess I've got a dateFormat matter.. but what's the workaround ? Thanks. Jeremy -- View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.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: IBatis: boolean mapping misunderstanding
Maybe with some info. Using ibatis2 or 3? Can you provide your mapped statement? Throw us a bone here. :P Larry On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote: I have in the table a boolean (tinyint(1)) value. I don't know why, but ibatis always gets it as true, whether it is 0, or 1 in database. Who knows what is the cause? -- View this message in context: http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.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: IBatis: boolean mapping misunderstanding
and domain.ClockUser is? On Mon, May 3, 2010 at 5:59 AM, vadboss vadb...@gmail.com wrote: It's IBatis 3. Here is the statement: select id=selectByUsernameAndPassword parameterType=domain.ClockUser resultType=domain.ClockUser SELECT users.id, users.username, users.password, MAX(clock_operations.date) as lastActionDate, clock_operations.clock_in as clockedIn FROM users, clock_operations WHERE users.id=clock_operations.user_id AND users.username=#{username} AND users.password=#{password}; /select Larry Meadors wrote: Maybe with some info. Using ibatis2 or 3? Can you provide your mapped statement? Throw us a bone here. :P Larry On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote: I have in the table a boolean (tinyint(1)) value. I don't know why, but ibatis always gets it as true, whether it is 0, or 1 in database. Who knows what is the cause? -- View this message in context: http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.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/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434308.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: IBatis: boolean mapping misunderstanding
OK, so you have a boolean in your bean, and a tinyint in your database and it's getting mapped to true regardless of the int value. What about insert/update? Are they setting the database to 0 and 1, or always using the same value? Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: iBatis Wiki page down?
Yeah, it's humped. Apparently there was an upgrade. :/ Larry On Fri, Apr 30, 2010 at 12:39 PM, Jon Webb jw...@compunetix.com wrote: Is it just me, or is the iBatis Wiki/FAQ page always down? Whenever I go to http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home I get a blank page. Or is my company’s firewall interfering? - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Select environment using XML
That's not runtime, either. :) I think Alex's solution is adequate for the original question, but if you really want to change it up on the fly, you should be able to easily replace the SSF (assuming you have it as a singleton) the same way - and if you add a function to your app that does it...bam, you're done. BTW (and only semi[ot]), I've been really pleased with how the configuration API has changed in ibatis3. This kind of stuff is SO much easier now. :-D Larry 2010/4/28 Björn Raupach raup...@e2n.de: This is not run-time. You must redeploy the application. Why not select the environment based on a property file? This way you only need to restart the application. environments default=${env} Looks like a nice feature. Is there anything to be said against it? On Apr 28, 2010, at 3:02 AM, Alex Park wrote: Hi, SqlSessionFactoryBuilder.build() method can select a specific environment in XML. For example, private Reader reader; private SqlSessionFactory sqlSessionFactorys; private SqlSession session; reader = Resources.getResourceAsReader(ibatis-config.xml); sqlSessionFactorys = new SqlSessionFactoryBuilder().build(reader, test); testSession = sqlSessionFactorys.openSession(); // test env sqlSessionFactorys = new SqlSessionFactoryBuilder().build(reader, dev); devSession = sqlSessionFactorys.openSession(); // dev env Thanks, Alex - 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: Problem with sql map XML files inside jar
Everything everywhere should always be utf-8, IMO. ;-) ISO-8859-1, WIN-1251, and MacRoman are all of the devil. Larry 2010/4/26 Björn Raupach raup...@e2n.de: Ok, solved my issue. I added the following statement before instantiating SqlSessionFactory. [..] Resources.setCharset(Charset.forName(UTF-8)); reader = Resources.getResourceAsReader(resource); SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader,props); [..] Maybe UTF-8 should be set as the default charset not the system charset. After all the xml files are declared as utf-8 in the header. cheers, Björn On Apr 22, 2010, at 6:42 PM, Björn Raupach wrote: Hi, there are some german umlauts in my mapper files. In fact all the column and table names in the database are in german. Unit tests run fine. If I create a jar file and include all the mapper files, the application crashes with an sql exception because the umlauts in the table name are not properly encoded e.g. Pers‚îú√ÇnlicheKontakte instead of PersönlicheKontakte Has anyone else experienced this issue before? kind regards, Björn- 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
Using auto-discovery for ibatis3 configuration - works great, less XML
I spent the weekend exploring how to use convention-based configuration with ibatis3 on a new project I'm working on. Open source is great, so I lifted the Stripes ResolverUtil class to assist me in finding classes that I then wired into my ibatis configuration at startup. For example: - I have all of my beans in one package, so I create type aliases for all of them: blah.blah.Order becomes Order - I have all of my type handlers in one package, so I register (or alias) them the same way (more on this in a bit) - I have all of my mapper interfaces in one package, so I register all of them the same way My current configuration eliminates the main XML configuration file, and I also put the SQL map XML files in the same packages as the mapper interfaces, so registering the interface loads the XML SQL maps, too. One thing I did have to add is a @MappedType(class[]) annotation for my type handlers - this allows me to control if I want to have my type handlers registered globally or just aliased - without the annotation, they are just aliased (so blah.blah.OrderHandler becomes OrderHandler - simpler to use in the XML files). With the the annotation, I register it globally for the types listed. If folks are interested in seeing more on this, I can put together a simple example app that does it (or help someone out if they want it sooner). Anyone? Larry PS: This may be more appropriate on the dev list, but since Stripes is distributed under ASL2, I could even add this to the core - it's one new class, and we could extend the configuration API to have these kinds of methods: - typeHandlerRegistry.registerPackage(String packageName); - configuration.addMapperPackage(String packageName) - typeAliasRegistry.registerAliases(String packageName); - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: inserting special characters
...or since you're using ibatis2, #param# instead of $param$. :) On Sat, Apr 17, 2010 at 2:55 AM, Andrius Juozapaitis andri...@gmail.com wrote: It's likely that you used the ${param} notation that includes the string in query instead of #{param}, which binds a prepared statement parameter. regards, Andrius On Sat, Apr 17, 2010 at 10:08 AM, vnug v...@cox.net wrote: Hi: We are using iBATIS2 and PostgreSQL8.3 with pgjdbc3 and Java1.5. We are trying insert a string with single quote and it is failing with SQLException. We were under the impression iBATIS uses PreparedStatement for the database connections and this should take care of escaping the single quote. Is there anything we are missing? I am attaching the error messages for reference: [Sat Apr 17 09:56:13 IST 2010] Exception in product logicCreate failed; nested exception is: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in xmlfolder/insert.xml. --- The error occurred while applying a parameter map. --- Check the insertproductspecificationtemp-InlineParameterMap. --- Check the statement (update failed). --- Cause: java.sql.SQLException: ERROR: syntax error at or near round at character 176 syntax error at or near round at character 176 STATEMENT: insert into product_specification_temp (product_specification_id,serial_no,test,specification,stp_id) values ('IDS007-01','4','tst descrption','peach colored 'round' shaped film coated tablets','IDT007-01') === I would appreciate any pointers to resolve this issue. Thank you. -- View this message in context: http://old.nabble.com/inserting-special-characters-tp28274483p28274483.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: Ibatis Mysql Sql error but sql runs fine
Try $tableName$. On Mon, Apr 12, 2010 at 4:17 PM, Corporate Tool mytrashacco...@gmail.com wrote: I am creating a table dynamically. statement id=createIndexTable parameterClass=IndexTableLoaderModel CREATE TABLE #tableName# ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); /statement It looks like the parameter is there it's just not being replaced correctly. Any Ideas? I get the following from the log4j console-- DEBUG 04-12 17:08:29 {conn-18} Preparing Statement: CREATE TABLE ? ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-19} Executing Statement: CREATE TABLE ? ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-19} Parameters: [VIX] (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-19} Types: [java.lang.String] (JakartaCommonsLoggingImpl.java:27) I get the following from stackTrac--- org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in Index.xml. --- The error occurred while applying a parameter map. --- Check the createIndexTable-InlineParameterMap. --- Check the statement (update failed). --- Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''VIX' ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHA' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:230) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:197) at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:368) at blintz.dyndns.org.zSystemProject.dao.impl.IndexTableLoaderDaoImpl.createTable(IndexTableLoaderDaoImpl.java:11) at blintz.dyndns.org.zSystemProject.service.impl.IndexServiceImpl.loadIndex(IndexServiceImpl.java:50) at blintz.dyndns.org.zSystemProject.DataLoadTest.tryTest(DataLoadTest.java:22) 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:585) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at
Re: Insert using a Map
#permission.id# On Thu, Apr 8, 2010 at 1:59 AM, flanagann flanag...@telecable.es wrote: Hello, hope you can help me with this issue. I'm trying to do an INSERT operation as follows: insert id = permissionsGroup.addPermission parameterClass = java.util.Map INSERT INTO FOO_TABLE (ID1, ID2) VALUES (#permissionsGroupId#, #permission#.id) /insert The map contains two pairs key, value: - permissionsGroupId, Integer - permission, Permission where Permission is a not primitive Object. What I want to do is to insert the parameter 'id' from the object Permission. How can I get this working? Thanks in advance! -- View this message in context: http://old.nabble.com/Insert-using-a-Map-tp28175373p28175373.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: SqlSession.close() without committing
There never has and most likely never will be an ibatis specification. Larry On Tuesday, April 6, 2010, cowwoc cow...@bbs.darktech.org wrote: Yes, iBATIS will rollback the connection if it deems it necessary. The only time you might need to call rollback explicitly is if you have a select that actually updates data in the database. Such is sometimes the case with stored procedures. Clinton, Coming back to our earlier discussion of Javadoc... where do you document the iBatis specification? I hope you understand my reluctance of depending on behavior outside of an explicit specification. Today one person will tell me the method works one way, tomorrow another person will tell me a different story. I'd love to have an official document to refer back to. Thanks, 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
Re: SqlSession.close() without committing
On Wed, Apr 7, 2010 at 11:04 AM, Clinton Begin clinton.be...@gmail.com wrote: There was once a man named Larry, Who felt my code was scary, For the code at which he balked, He wrote JavaDocs, And left the community merry. LOL! Should I be worried that you're writing poetry about me? :-D I guess I'll just be glad you didn't use the words hairy or dingleberry... Larry PS: Shut up Brandon. - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: return simple String[] or ListString
You want result*Class*=java.util.String - not result*Map*=java.util.String. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
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
Re: Problem with Character Encoding
Where are you seeing the ? characters? On Fri, Mar 12, 2010 at 3:14 PM, John Seer pulsph...@yahoo.com wrote: Hello, I am not sure where is problem... If I am using hibernate I am getting data back with out problems... Only combination is ibatis and oracle. I am currently using JNDI to connect and saw in documentation for ibatis 3 that I can set env.encoding=UTF-8... I tried to use it no difference. :( Ellis Miller wrote: If you think it's on the Oracle side start by checking NLS_LANG settings: http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm#_Toc110410543 Would try an Oracle Alter Session for NLS_LANG and see if that helps: http://forums.oracle.com/forums/thread.jspa?threadID=436286tstart=360 Ellis R. Miller 937.830.8242 937.830.6027 --- @ WiseStamp Signaturehttp://my.wisestamp.com/link?u=2hxhdfd4p76bkhcmsite=www.wisestamp.com/email-install. Get it nowhttp://my.wisestamp.com/link?u=2hxhdfd4p76bkhcmsite=www.wisestamp.com/email-install On Fri, Mar 5, 2010 at 6:27 PM, Larry Meadors larry.mead...@gmail.comwrote: I'd look for info on the oracle connection string, it's not really an ibatis thing. I think that it happens that way by default though. Where are you seeing the ? characters? Larry On Fri, Mar 5, 2010 at 2:44 PM, John Seer pulsph...@yahoo.com wrote: Hello, We am currently using Oracle DB with default utf-8 encoding, we have two application one is using hibernate other one ibatis If I am running hibernate on windows or on linux I am seeing every character which is returned is encoded correctly. But when I am using ibatis I can see that some of my characters were replace by question mark others with replacement character when I run it on linux. Is there any way to force connection encoding for ibatis? I googled this only reference about setting connection encoding is for ibatis 3. I am currently using 2.3.4.726. John -- View this message in context: http://old.nabble.com/Problem-with-Character-Encoding-tp27799549p27799549.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/Problem-with-Character-Encoding-tp27799549p27883501.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: Problem with Character Encoding
I just happen to have spent the last month wrestling with Oracle and UTF-8 encoding. I had to deal with BLOBs, but Strings should be easier. Oracle stores VARCHAR2, VARCHAR, and CLOB fields as unicode and when the driver fetches the value, it goes into a String which is just an array of unicode characters, so that should be OK. Regardless of the database encoding, you should be getting unicode Strings back. Have you verified that the encoding of the jsp (and browser) are set to utf-8? Do you have a unit test that shows the problem? It might be worth examining the characters in the values that are boogered up to verify that they are coming through correctly. Look at the String in a debugger and you should be able to see the array of characters that make it up. For example, the é character should be \u00E9. If you convert it to bytes (yourString.getBytes(UTF-8)), you should see 2 byte values for that character: 0xC3 and 0xA9 - since those are bytes, they may show up in your debugger as negative values: -61 and -87. http://www.fileformat.info/info/unicode/char/00e9/index.htm Let us know what you find out. :) Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Problem with Character Encoding
I'd look for info on the oracle connection string, it's not really an ibatis thing. I think that it happens that way by default though. Where are you seeing the ? characters? Larry On Fri, Mar 5, 2010 at 2:44 PM, John Seer pulsph...@yahoo.com wrote: Hello, We am currently using Oracle DB with default utf-8 encoding, we have two application one is using hibernate other one ibatis If I am running hibernate on windows or on linux I am seeing every character which is returned is encoded correctly. But when I am using ibatis I can see that some of my characters were replace by question mark others with replacement character when I run it on linux. Is there any way to force connection encoding for ibatis? I googled this only reference about setting connection encoding is for ibatis 3. I am currently using 2.3.4.726. John -- View this message in context: http://old.nabble.com/Problem-with-Character-Encoding-tp27799549p27799549.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: java.util.UUID to postgres uuid column
I think the combination of #value# and the type handler should work - it may take some messing around and debugging to figure out what exactly is going on. Unfortunately, I just do not have the free time to do that. :-) If you would like me to block out a couple of hours to figure it out for you, feel free to contact me off list, and I will be glad to provide you with some additional professional support. Larry On Sun, Feb 28, 2010 at 2:49 AM, Vikram Subbarao vikra...@directi.com wrote: Hello All, Any idea on this? Regards Vikram Vikram Subbarao wrote: The uuid in database is stored in a column of type uuid supported by postgres db. Now when i use the query below, i am passing a string and would become VARCHAR to database which results in postgres db complaining that it cannot compare 'Character Varying' and 'uuid' values. I understand implicit casts happen in certain databases (like sql server), but not in postgres. Also, there are performance issues shuttling between UUID (128 bits) and String (36 Chars for type 4 uuid = 576 bits) and then back for a frequent query like this which seems mostly un-necessary if ibatis could understand and add this as a known type, especially since postgress jdbc supports java.util.UUID as a type. Regards Vikram meindert wrote: Hi Vikram, I don’t use the UUID myself and can’t answer your question from experience, but I think the real question would be how the ID is stored in the DB. IBATIS error message is is correct to say that the UUID object does not have a value (like a string or int object) and there is no UUID.getId() Assuming you use a ‘uniqueidentifier’ type on the (sql server) db side, I would think you need to query the ID as a string; select id=findById parameterClass=string resultMap=fullResult cacheModel=cache SELECT users.* FROM users WHERE id = #value# /select sqlMapClientTemplate.queryForObject(User.findById, id.toString()); From sql books online: A column or local variable of uniqueidentifier data type can be initialized to a value in the following ways: By using the NEWID function. By converting from a string constant in the form----, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid uniqueidentifier value. Comparison operators can be used with uniqueidentifier values. However, ordering is not implemented by comparing the bit patterns of the two values. The only operations that can be performed against a uniqueidentifier value are comparisons (=, , , , =, =) and checking for NULL (IS NULL and IS NOT NULL). No other arithmetic operators can be used. All column constraints and properties, except IDENTITY, can be used on the uniqueidentifier data type. Merge replication and transactional replication with updating subscriptions useuniqueidentifier columns to guarantee that rows are uniquely identified across multiple copies of the table. Regards Meindert Hoving From: Vikram Subbarao [mailto:vikra...@directi.com] Sent: 11 February 2010 10:13 AM To: user-java@ibatis.apache.org Subject: Re: java.util.UUID to postgres uuid column Does not work - com.ibatis.common.beans.ProbeException: There is no READABLE property named 'value' in class 'java.util.UUID' Niels Beekman wrote: Try #value#, this will use your parameter object directly. Using #id# tries to obtain the id property from it. From: Vikram Subbarao [mailto:vikra...@directi.com] Sent: Thursday, February 11, 2010 7:50 AM To: user-java@ibatis.apache.org Subject: Re: java.util.UUID to postgres uuid column With this approach i tried this in a query - select id=findById parameterClass=java.util.UUID resultMap=fullResult cacheModel=cache SELECT users.* FROM users WHERE id = #id# /select When i call this query as - sqlMapClientTemplate.queryForObject(User.findById, id); Note: id is an java.util.UUID object. I get an error - com.ibatis.common.beans.ProbeException: There is no READABLE property named 'id' in class 'java.util.UUID' Regards Vikram Larry Meadors wrote: This might work: public class UUIDTypeHandler implements TypeHandlerCallback { @Override public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { setter.setObject(parameter); } @Override public Object getResult(ResultGetter getter) throws SQLException { return getter.getObject(); } @Override public Object valueOf(String s) { return UUID.fromString(s); } } Add this in your sqlmapconfig.xml: typeAlias alias=UUID type=java.util.UUID / typeHandler javaType=UUID callback=UUIDTypeHandler/ Larry On Tue, Feb 9, 2010 at 3:35 AM, Vikram Subbarao vikra
Re: iBatis 3.0 minimal complete example
On Wed, Feb 10, 2010 at 2:21 PM, Rick R ric...@gmail.com wrote: And without leveraging Guice or Spring :) Rick, you pansy. ;-) - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: iBatis 3.0 minimal complete example
On Wed, Feb 10, 2010 at 6:21 PM, Clinton Begin clinton.be...@gmail.com wrote: Anyone and everyone is welcome (and encouraged) to create a JPetStore implementation with iBATIS using whichever framework they like. Rails it is. ;-) Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: java.util.UUID to postgres uuid column
This might work: public class UUIDTypeHandler implements TypeHandlerCallback { @Override public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { setter.setObject(parameter); } @Override public Object getResult(ResultGetter getter) throws SQLException { return getter.getObject(); } @Override public Object valueOf(String s) { return UUID.fromString(s); } } Add this in your sqlmapconfig.xml: typeAlias alias=UUID type=java.util.UUID / typeHandler javaType=UUID callback=UUIDTypeHandler/ Larry On Tue, Feb 9, 2010 at 3:35 AM, Vikram Subbarao vikra...@directi.com wrote: I am using postgres db and would like to map a java.util.UUID to a postgres uuid column. Latest postgres driver supports mapping of this if i was directly creating my prepared statements but since i use ibatis inbetween, i am unable to achive this as ibatis does not seem to understand that java.util.UUID can be based down to jdbc. I could use typehandler if the db column was a VARCHAR, but since the postgres db is a 'uuid' type, i have no option but to use the driver supported option of using java.util.UUID, but it does not work with ibatis for me. Please help me if some one has a solution to this. Regards Vikram - 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
Try this: select * from ${value} Larry On Mon, Feb 8, 2010 at 3: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: update without set element
Do this in Java code. Doing it in xml is kinda silly. :) Larry On Wed, Jan 20, 2010 at 12:00 AM, masonka...@libero.it masonka...@libero.it wrote: Hi, I have a write a update statement with condition on every set element. If no condition are matched set part are empty, but where part is already created and this cause a sql error (ex.: update where id=4). I show an example about it: update iord set if test=oldVO.bank != newVO.bank bank=#{newVO.bank,jdbcType=VARCHAR}, /if if test=oldVO.agency != newVO.agency agency=#{newVO.agency,jdbcType=VARCHAR}, /if if test=oldVO.iban != newVO.iban iban=#{newVO.iban, jdbcType=VARCHAR}, /if /set where id = #{oldVO. id} /update if there aren't no change in bank, agency and iban set part is empty and sql not correct. I try to solve the problem inserting in set statement a field that assign value to itself. update iord set id=id, if test=oldVO.bank != newVO.bank bank=#{newVO.bank,jdbcType=VARCHAR}, /if if test= oldVO.agency != newVO.agency agency=#{newVO.agency, jdbcType=VARCHAR}, /if if test=oldVO.iban != newVO. iban iban=#{newVO.iban,jdbcType=VARCHAR}, /if if test=oldVO.id != newVO.id id=#{newVO.id, jdbcType=VARCHAR}, /if /set where id = #{oldVO. id} /update But if also the id are interested in change there are some problem. Any idea? thanks. - 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: Dropping down to JDBC.
sqlMapClient.getDataSource(); On Wed, Jan 20, 2010 at 7:05 AM, Wesley Acheson wesley.ache...@gmail.com wrote: Hi all, we have a need to drop down to a JDBC query at some point in our application. Is it possible to get a connection from the SimpleDataSource pool. (I see that this is a method on SimpleDataSource). If so how does one return the connection to the SimpleDataSource object? Regards, Wesley Acheson. - 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: Dropping down to JDBC.
Just close the connection when you're done - that won't REALLY close it, it will just return it to the pool (just like any other connection pool). Larry On Wed, Jan 20, 2010 at 7:17 AM, Wesley Acheson wesley.ache...@gmail.com wrote: Yes thats what I suspected. When the JDBC queries run do I close the connection object returned by this SimpleDataSource object? or is there some other way to return the connection back to the pool? Regards, Wesley Acheson On Wed, Jan 20, 2010 at 3:12 PM, Larry Meadors larry.mead...@gmail.com wrote: sqlMapClient.getDataSource(); On Wed, Jan 20, 2010 at 7:05 AM, Wesley Acheson wesley.ache...@gmail.com wrote: Hi all, we have a need to drop down to a JDBC query at some point in our application. Is it possible to get a connection from the SimpleDataSource pool. (I see that this is a method on SimpleDataSource). If so how does one return the connection to the SimpleDataSource object? Regards, Wesley Acheson. - 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: How about a Netbeans integration plugin?
I think that is a great idea - I think google's got better infrastructure than Apache. :-/ Larry On Sat, Jan 2, 2010 at 9:19 PM, Clinton Begin clinton.be...@gmail.com wrote: What do you guys thing of creating a google code project for iBATIS plugins? This would avoid the need to get everyone signing CLAs and would give you more freedom over your project. At the same time, it would keep the iBATIS codebase free of 3rd party dependencies. We could organize it into categories like: IDE Support, Cache Support, DataSource Support, Plugins, Utilities etc... I think it would be simpler and easier to manage these outside of the Apache process. Of course, all would still have to be Apache 2.0 licensed. Clinton On Sat, Jan 2, 2010 at 2:47 PM, Nathan Maves nathan.ma...@gmail.com wrote: So I have the first version of the Netbeans Plugin Module done. Simple yet functional. I have yet to put it into svn but let me know if you want to try it out. Or if there are other features that you may want. Configuration features Hyperlink to mapper files Hyperlink typeAlias to java source Mapper features Hyperlink select resultMap attribute to resultMap definition when resultMap is local Hyperlink resultMap type attribute to java source when value is a fqn Yet to be implemented Auto complete of resultMap attribute Auto complete of type attribute Issues How to link a mapper type to a typeAlias On Sun, Dec 27, 2009 at 11:57 AM, Nathan Maves nathan.ma...@gmail.com wrote: just a heads up I started working on a plugin this morning. I would love some help so if you are interested let me know and we can collaborate. Nathan On Sun, Dec 27, 2009 at 5:44 AM, Kai Grabfelder nos...@kaigrabfelder.de wrote: Hi there, some while ago I directed a student projects leading to the creation of an eclipse plugin for iBATIS (eclibatis: http://sourceforge.net/projects/eclibatis/) which does the following things: - navigating to myResultMap declaration when CTRL-clicking on resultMap=myResultMap in a select block. - opening corresponding .java files using the same hyperlinking strategy as above. - enabling autocompletion for various ids (resultMap, sql) or java class names. Unfortunately sourceforge remove the wiki functionality so all the documentation (that was within the wiki) is gone. I'm also not sure if it still works with latest spring IDE Eclipse 3.5 versions. As always time constraints hinder me from releasing an updated version ;-( Regards Kai --- Original Nachricht --- Absender: stefcl Datum: 27.12.2009 11:49 Guy Rouillier-2 wrote: I don't use NetBeans. Do Eclipse plugins work there? If so, check out Ibator from the IBATIS website. It will handle at least some of the tasks you've identified (generates POJOs, result maps, etc.) Quoted from: http://old.nabble.com/How-about-a-Netbeans-integration-plugin--tp26926675p26932342.html I have already had a look at ibator, I would use it to get started on a new project with IBatis, for generating the typical CRUD stuff for the most basic DB tables. However, in the kind of project I'm working on, 1:1 mappings between java objects and relational table aren't always suitable, and even so, there's a lot more I need to do with my database. One way or another, I'm really not sure you can escape editing your XML files by hand at some point. That's the main reason why I think an IDE module adding some ibatis specific support to the existing XML editor would be enjoyable. - 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: working with raw mapk,vs instead of entities?
Interesting idea - so you end up with something like this? myEntity.id myEntity.name myEntity.attributes.someField myEntity.attributes.someOtherField You could do that, but since you're doing select * you'd have to do it with a result map or row handler. Larry On Thu, Dec 17, 2009 at 1:32 AM, Kristian Rink li...@zimmer428.net wrote: Folks; not sure whether this is a stupid question; I've been playing with this idea before already: As far as I see, after dealing with a bunch of other approaches (EclipseLink/JPA, hibernate, ...), I saw that in the end parts of our backend code ended up being a weak re-implementation of the iBatis idea, which makes me reconsider iBatis once again. For now, looking at the feature set, there is one thing I would want to do with iBatis, but I am not sure how to do so / whether it can be done at all: In my situation, I select * from a bunch of tables joined via an identifier, to, by then, take the identifier and a few other fixed columns which will appear all the time and put them into designated values of an entity, and the rest of the selection simply goes to a Mapstring,string inside the entity. While this works pretty well, say, inside a Spring JdbcTemplate mapper, I am unsure how / if to do something like this in an iBatis configuration file as well. So to ask: - Is it possible? - How to do it, if so? Thanks a bunch in advance and kindest regards, Kristian - 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 Microsoft Access
Yes, the jdbc-odbc bridge is not really intended for real use, and sucks pretty bad. Without knowing why you are using access, it's hard to recommend a course of action - if you can use a different DB, by all means, do. Access is hands down the crappiest choice you could make. :) If you are using it because you have to (it's tied to another system that uses access directly), then you may need to look for a commercial driver. The jdbc-odbc bridge will not work. If you are creating a new system, then look at postgresql, mysql, or derby. Larry On Sat, Dec 12, 2009 at 9:32 AM, Monky promil...@yahoo.de wrote: Hello, I am having problems using Ibatis/Ibator (ibatis-2.3.4.726 and the latest ibator as eclipse plugin installed via http://ibatis.apache.org/tools/ibator) with a connection to Microsoft Access. When I use the Ibator eclipse Plugin to Generate iBatis Artifacts many things get generated properly but I get the warnings: Generation Warnings Occured Cannot obtain primary key information from the database, generated objects may be incomplete The second line appears once for every table. I use the standard driver: Driver: sun.jdbc.odbc.JdbcOdbcDriver URL: jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=[ABSOLUTE_PATH_TO_MY_DB_FILE];DriverID=22 I guess the sun JDBC-ODBC-Bridge does not fully support table meta data for Mircosoft Access. Am I supposing correct? Is there another (free) driver that could be used? Is there a way to tell iBator about primary keys manually? (Something like: every table has a PKEY column that is a integer auto increment primary key field) Any help appretiates. Regards, Sebastian -- View this message in context: http://old.nabble.com/Ibator-and-Microsoft-Access-tp26758969p26758969.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: Search for character '_', '%' wildcard characters using ibatis
You should be able to do it the same way with ibatis...did you try it? Did you get an error? Can you pass the error along? Larry On Fri, Dec 11, 2009 at 1:42 AM, crmanoj manojrathi...@gmail.com wrote: I am developing a webapplication using Struts for which oracle is a backend. For connectivity i am using iBatis. My application has a search page where the user enters an id which inturn gets the data from DB. The primary key for table which i am using is of type 'VARCHAR'. The values for this primarykey field can contain characters like '_', '%' which are wildcard characters. For example: id name user_1 Tom user_2 Harry Suppose if a user wants to search for all rows which has '_' in their primary key, how do i get this in iBatis. In a normal sql query in oracle, i can use the keyword 'ESCAPE' for escaping the special characters. For eg: SELECT id,name FROM EMPLOYEE WHERE id LIKE '%\_%' ESCAPE '\' How do i handle this in iBatis?. I am using the method 'queryforlist' in java to get the data. In SqlMap, i am using select tag. Thanks in Advance. -- View this message in context: http://old.nabble.com/Search-for-character-%27_%27%2C-%27-%27-wildcard-characters-using-ibatis-tp26740551p26740551.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 iBatis just for generating 'Dynamic SQL'
On Tue, Dec 8, 2009 at 11:44 PM, Prem75 premkum...@virtusa.com wrote: 2. Does iBatis have a professional support that we can sign up for? Several of us (Brandon, Nathan, and myself) are full-time contract developers. I'd love to work with you, and I suspect the others would as well. That would be a conversation to have off-list, but don't expect it to come cheap or you will be disappointed. ;-) 3. Is there a process through which we can request for a paid new feature in iBatis? We've never tackled that specifically, but I don't see any obvious roadblocks unless what you're asking for would be a breaking change - i.e., something that would make existing ibatis users' systems break. 4. Is there a way to get the dynamically generated SQL before execution? Yes, I have done that before with ibatis 2 (not 3 yet), and it was really pretty simple. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Issues with Ibatis Configuration File
Move the typeAliases section above environments. Larry On Wed, Dec 9, 2009 at 2:54 PM, Soks86 michael.chrostow...@gmail.com wrote: Hi, I have created the following configuration file for my Ibatis SqlSessionFactoryBuilder. ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE configuration PUBLIC -//ibatis.apache.org//DTD Config 3.0//EN http://ibatis.apache.org/dtd/ibatis-3-config.dtd; configuration environments default=development environment id=development transactionManager type=JDBC / dataSource type=POOLED property name=driver value=org.apache.derby.jdbc.EmbeddedDriver / property name=url value=jdbc:derby:/home/mchrosto/MyTestDB;create=true / !-- property name=username value=${username} / property name=password value=${password} / -- /dataSource /environment /environments typeAliases typeAlias alias=TradableDao type=com.icarus.common.strategies.dao.TradableDao / typeAlias alias=Tradable type=com.icarus.common.strategies.Tradable / /typeAliases mappers mapper resource=src/main/resources/IbatisMaps/TradableDao.xml / /mappers /configuration If I remove the typeAliases portion (and rename my aliases inside of TradableDao.xml) then it works just fine. However when I put the aliases in (exactly as shown above) I get XML parsing exceptions... in particular: ### Error building SqlSession. ### The error may exist in SQL Mapper Configuration ### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of element type configuration must match (properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,plugins?,environments?,mappers?). Also my IDE (Eclipse) complains that the xml file is not compliant with the DTD file... all of this goes away if I remove my aliases. Anyone have any idea why this might be ocuring? I'm alright for now without aliases but as I get farther and farther into iBATIS I fear that I will need them to stay sane. Just to be clear this is iBATIS 3 - Beta 5 and should be the latest file from repository.sonatype.org. Thanks in advance for any help! Michael Chrostowski -- View this message in context: http://old.nabble.com/Issues-with-Ibatis-Configuration-File-tp26718012p26718012.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: IBatis 3 Exceptions
Email the server admin? :D Larry On Fri, Dec 4, 2009 at 10:27 AM, Rick.Wellman rick.well...@kiewit.com wrote: Agreed on both points below… but am curious to the community at large… has anyone come up with something useful to do on a database exception other than apologize to the user? This might be a good forum to share. From: Clinton Begin [mailto:clinton.be...@gmail.com] Sent: Thursday, December 03, 2009 7:47 PM To: user-java@ibatis.apache.org Subject: Re: IBatis 3 Exceptions Nope. Nothing technical. I just happen to hate checked exceptions. :-) The original exception is always nested within the runtime one though, so you have full access to everything you need. There is a bit of placeholder code where I had intended to build a hierarchy of exceptions, similar to Spring's exceptions. But honestly, I cannot recall a time in my 12 years of Java coding when I could actually do something useful with a database exception, other than apologize to the user with a dialog box. Clinton On Thu, Dec 3, 2009 at 2:15 PM, Alex Sherwin alex.sher...@acadiasoft.com wrote: Why does IBatis 3.0 throw IbatisException (RuntimeException) instead of checked exceptions? Is this a limitation now due to the dynamic nature of the generic typed mapped statement classes? IbatisException doesn't even seem to wrap SQLException, I see it wrapping the native exceptions from my JDBC driver (MySQL). - 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: Re: Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.
Hm, it seems to have cut off the useful parts - the swing and awt stuff doesn't help at all. :( What driver are you using? Larry On Tue, Nov 24, 2009 at 11:57 PM, masonka...@libero.it masonka...@libero.it wrote: Here my stack trace: org.apache.ibatis.exceptions.IbatisException: ### Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed. ### The error may exist in org/acl/dbmapping/User.xml ### The error may involve org.acl.base.user.insert ### The error occurred while executing an update ### SQL: select count(1) as num from role where role=? ### Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:95) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:82) at org.common.lib.Manager.insert(Manager.java:84) at provagui.UserDetailFrameController.insertRecord(UserDetailFrameController.java:66) at org.openswing.swing.form.client.Form.save(Form.java:1670) at org.openswing.swing.client.SaveButton.executeOperation(SaveButton.java:50) at org.openswing.swing.client.GenericButton.execute(GenericButton.java:143) at org.openswing.swing.client.GenericButton$1.actionPerformed(GenericButton.java:63) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272) at java.awt.Component.processMouseEvent(Component.java:6263) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6028) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at org.openswing.swing.util.client.ApplicationEventQueue$InternalEventQueue.dispatchEvent(ApplicationEventQueue.java:130) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: org.apache.ibatis.executor.ExecutorException: Executor was closed. at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:63) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:39) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:93) ... 34 more Messaggio originale Da: clinton.be...@gmail.com Data: 25/11/2009 4.44 A: user-java@ibatis.apache.org, masonka...@libero.itmasonka...@libero.it Ogg: Re: Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed. Stack trace? On Tue, Nov 24, 2009 at 4:11 PM, masonka...@libero.it masonka...@libero.it wrote: Hi, I have a problem when I try to insert into table e new line. Ibatis (version 3, beta 5) report the error message: Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed. the insert clause used is: insert into user (usr,pwd,role,dsc,sts) values (#{username},#{password},#{role},#{description},#{status}) What's strange is that the delete function and the update one work fine. Could you give me some advice about the origin of the problem? Thanks.
Re: OOM with millions of weakly-referenced Derby objects
The expected behavior is really dependent upon the underlying JDBC driver. Using the maxRows parameter is a last resort option, IMO. Limit the results with the SQL if at all possible, here's an example: http://old.nabble.com/top-N-reporting-with-derby-td17221545.html Larry On Tue, Nov 17, 2009 at 11:42 AM, Eric Floehr eric.flo...@3x.com wrote: All, I have a Derby table with up to a million rows. Some large subset of those rows may be returned by a SELECT query. I am using IBATIS quertyForList with the embedded Derby driver. I am using the version which has a maxRows parameter. I call that method and receive back the proper “maxRows” java.sql.ResultSet objects. For example, the select would match 100,000 rows, but I only get the first 200. That all works fine. However, I am getting OOM’s when the select would match nearly a million rows and after profiling with JProfiler the culprit seems to be millions of weakly referenced org.apache.derby.iapi.types.SQL objects (SQLLongInt, for example) that appear to be created far faster than they can be GC’ed. This particular performance test run would return a million records, of which I am only wanting to retrieve the first 200. My questions are: 1. Is this expected behavior? 2. Is IBATIS properly using a cursor, or what is the right way to limit the number of Derby objects created (the ResultSet count is correct) 3. Are there Derby or IBATIS parameters that can be employed to correct this behavior? Derby version is 10.5.3, IBATIS version is 2.3.4.726, and Java version is 1.6. I have cross-posted to both the Derby and IBATIS lists since I don’t know where the root problem resides. Thanks so much for your help! Best Regards, Eric - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: static SqlMapClient and transaction isolation problem
On Thu, Oct 22, 2009 at 9:03 AM, User 080701 user080...@hotmail.com wrote: If I create a static SqlMapClient to service many threads, does ibatis guarantee transaction isolation ? yes. e.g. If one thread start the transaction and not commit, if another thread start the transaction using the same sqlMapClient, does it throw transaction already start exception ? no. - 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
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 parameter there? I don't see where it would ever be non-null. Larry - 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
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 parameter there? I don't see where it would ever be non-null. Larry - 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
On Mon, Oct 19, 2009 at 1:17 PM, Jim Borland jborl...@calpoly.edu wrote: 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! A connection pool is simply a collection of connection objects that are kept open as a performance optimization technique. Creating network connection to a database server can be an expensive operation (in terms of time), so often web servers will create a pool of connections that are left open and then shared as needed. When you ask for a new connection, you get an already opened connection from the pool, instead of waiting for a new one to be opened, and the pool marks it as in use so no one else gets it. When you close that connection, the pool just marks it as available so that it can be reused. That may be why you are seeing idle connections when you aren't expecting them. After you have closed the connection, it's still open - that's how a pool works - but it may show up as idle. Larry - 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
OK, you need to refactor that. :-) The sqlMap should only be created once. I'm not a struts2 user, so I can't say what the appropriate way to do that is. :-/ If you just want to go ghetto style, you could use a static variable to hold it and initialize it when the class is loaded...but I'd really only do that to get a proof of concept working. You should look at the struts2 way of doing it, or write a context listener to do it when your application starts up. A bit more unsolicited criticism, if you don't mind: Unless that artist list varies by user (it doesn't look like it does) putting it in session scope is probably not needed - you could put it in request scope, cache it in ibatis, and share a single instance of that list for all users - that would make your application faster and use less memory. Using ArrayList as ArrayList is almost never a good idea - unless you need specific implementation features, just treat it as a List instead. Using e.printStackTrace() is really bad - you'd be better off just saying something like throw new RuntimeException(e); because that way the application won't just silently fail. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Problem when parsing dao.xml
Nah, mockito is cooler than even guice. It's the shiz. If you can't test your code with mockito...go home or become a manager. ;-) Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Database Connection reset on Oracle 10g AS using Oracle 11g database
Use select 1 from dual instead. On Tue, Oct 6, 2009 at 10:57 AM, Jasmin Mehta jasmin_me...@nexweb.orgwrote: I have changed my spring.xml accordingly: bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource destroy-method=close property name=driverClassName value=${jdbc.driverClassName}/ property name=url value=${jdbc.url}/ property name=username value=${jdbc.username}/ property name=password value=${jdbc.password}/ property name=validationQuery value=SELECT 1/ property name=testWhileIdle value=true/ property name=timeBetweenEvictionRunsMillis value=30/ property name=numTestsPerEvictionRun value=6/ property name=minEvictableIdleTimeMillis value=180/ /bean But now I am getting runtime exception: [06 Oct 2009 11:32:13] DEBUG [UserSqlMapDAO] Opened SqlMapSession [com.ibatis.sqlmap.engine.impl.sqlmapsessioni...@282f55] for iBATIS operation [06 Oct 2009 11:32:13] DEBUG [DataSourceUtils] Fetching JDBC Connection from DataSource [06 Oct 2009 11:32:13] ERROR [WelcomeAction] org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (*ORA-00923: FROM keyword not found where expected* ) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:204) at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271) at org.nexweb.qol.gcc.ibatis.dao.sqlmaps.UserSqlMapDAO.getUserByUserNameAndRealmName(UserSqlMapDAO.java:26) at org.nexweb.qol.gcc.ibatis.services.UserService.getUserByUserNameAndRealmName(UserService.java:30) at org.nexweb.qol.gcc.actions.WelcomeAction.execute(WelcomeAction.java:76) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259) at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51) at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283) at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198) at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:392) at _jsp._forward._jspService(_forward.java:48) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:724) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:414) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111) at
Re: connection problem using ibatis2.3+postgresql8.3+glassfish2 ( An I/O error occured while sending to the backend.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException)
Probably a stale connection. Google for org.postgresql.util.PSQLException: An I/O error occured while sending to the backend Larry On Thu, Sep 10, 2009 at 8:01 PM, Donmis donmi...@gmail.com wrote: HELP HELP!!! :,( -- View this message in context: http://www.nabble.com/connection-problem-using-ibatis2.3%2Bpostgresql8.3%2Bglassfish2-%28-An-I-O-error-occured-while-sending-to-the-backend.--nested-exception-is-com.ibatis.common.jdbc.exception.NestedSQLException%29-tp25394317p25394320.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: Insert statement returns generated key
Couldn't you call it just as a procedure? Larry On Fri, Aug 28, 2009 at 9:02 AM, Clinton Beginclinton.be...@gmail.com wrote: I don't, but that's pretty awesome that you figured that out and it works... LOL. :-) Clinton On Fri, Aug 28, 2009 at 8:56 AM, Beary, Nick (EHQ) nbe...@express-scripts.com wrote: Hello, I looked around for an answer to this but didn’t see anything. To insert objects in our database, I have to use a macro that returns the key of the newly inserted object. This means that the entirety of my insert statement is located in the selectKey section. Because an SQL statement is required in the PCDATA section outside of selectKey, I just put a ; there. So it looks like this: insert id=insert-xxx parameterClass=xxx ; selectKey resultClass=int keyProperty=ID exec insert_macro(…) /selectKey /insert Does anybody know a more elegant/less hacky solution to this? We are using Teradata 12.0. Thanks! Nick - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Why in Application is worked, but in JSP don't worked?
Good heavens, why would you EVER put that in a jsp? If you have to, the error is Unable to compile class for JSP: An error occurred at line: 1 in the generated java file The type com.ibatis.sqlmap.client.SqlMapClient cannot be resolved. It is indirectly referenced from required .class files Looks like it can't find all the classes. My advice: If it hurts when you hit yourself in the head with a hammer, then don't do it. If you can't do something you shouldn't in a jsp, don't. ;-) Larry On Mon, Aug 24, 2009 at 6:44 AM, bhaab...@yandex.ru wrote: Hi, All. Explain to me please why it works in Application: public static void main(String[] args) { Reader reader = null; SqlMapClient client = null; try { reader = Resources.getResourceAsReader(com/rns/guvd/xml/SqlMapConfig.xml); client = SqlMapClientBuilder.buildSqlMapClient(reader); reader.close(); } catch (IOException e) { e.printStackTrace(); } ... } but does not work in JSP: ... %@ page import=com.ibatis.common.resources.*,com.ibatis.sqlmap.client.* % ... % SqlMapClient sqlMapClient = null; try { Reader reader = Resources.getResourceAsReader(com/rns/guvd/xml/SqlMapConfig.xml); sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader); reader.close(); } catch (IOException e) { e.printStackTrace(); } ... % org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the generated java file The type com.ibatis.sqlmap.client.SqlMapClient cannot be resolved. It is indirectly referenced from required .class files An error occurred at line: 28 in the jsp file: /test.jsp SqlMapClient cannot be resolved to a type 27: % 28: SqlMapClient sqlMapClient = null; 29: try { 30: Reader reader = Resources.getResourceAsReader(com/rns/guvd/xml/SqlMapConfig.xml); 31: sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader); An error occurred at line: 30 in the jsp file: /test.jsp Resources cannot be resolved 27: % 28: SqlMapClient sqlMapClient = null; 29: try { 30: Reader reader = Resources.getResourceAsReader(com/rns/guvd/xml/SqlMapConfig.xml); 31: sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader); 32: reader.close(); 33: } catch (IOException e) { An error occurred at line: 31 in the jsp file: /test.jsp SqlMapClientBuilder cannot be resolved 28: SqlMapClient sqlMapClient = null; 29: try { 30: Reader reader = Resources.getResourceAsReader(com/rns/guvd/xml/SqlMapConfig.xml); 31: sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader); 32: reader.close(); 33: } catch (IOException e) { 34: e.printStackTrace(); Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435) org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) org.apache.jasper.compiler.Compiler.compile(Compiler.java:277) org.apache.jasper.compiler.Compiler.compile(Compiler.java:265) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) Explain please to me in what a problem. Alexander -- View this message in context: http://www.nabble.com/Why-in-Application-is-worked%2C-but-in-JSP-don%27t-worked--tp25115452p25115452.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: Why in Application is worked, but in JSP don't worked?
Stripes is awesome. On Mon, Aug 24, 2009 at 8:11 AM, bhaab...@yandex.ru wrote: Thinks, I shall look now it. Poitras Christian wrote: Hi, You can see JSP as being close to an HTML page. It is better if you never put any scripting in a JSP (being % %). Many frameworks exists to simplify the use of JSP in an MVC framework. Strust and Stripes are only a few examples. In Struts you would put you database calls in Action class, in Stripes it is an ActionBean. In both cases, you may want to put your database calls into a service class. The service methods would then be called by you Action/ActionBean class. You are better of reading about MVC framework (Stripes site at http://www.stripesframework.org/display/stripes/Home is nice) and programming Patterns. Christian -- View this message in context: http://www.nabble.com/Why-in-Application-is-worked%2C-but-in-JSP-don%27t-worked--tp25115452p25116757.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: Separate iBATIS3 mailing list
Because it's a bad idea. Happy? Larry On Fri, Aug 21, 2009 at 12:47 AM, Nicholoz Koka Kiknadzekikna...@gmail.com wrote: No reply... Seems separate list idea is soo absurd that no one bothers to explain why ;) On Tue, Aug 18, 2009 at 10:00 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: I've enjoyed much using iBatis and the mailing list was always very helpful. Well, now and then I have to search for answers in the mailing list and usually find the answer ;) So far so good. But... I've used mailing list for another framework - Tapestry for three major versions (3/4/5) and always found it very annoying not to be able to filter for which version I needed to search. Now, as questions about iBatis3 start to pore in I wondered maybe in long run it may be better to have separate mailing list for it. I don't mind subscribing to two lists - my gmail inbox will handle both ;) Wonder what others think... - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Separate iBATIS3 mailing list
Heh - I hadn't had my coffee yet. ;-) Here are a few reasons: Pick one or take two, they're small. #1 - It's a bad idea to fragment an already small community (1000 users on the list) because one user doesn't want to get the dozen or so emails a day that the list generates. #2 - Just like ibatis1, ibatis2 will eventually fade away and ibatis3 will become the main release. At what point do we kill the old list? When there are 2 people on it? #3 - I think I'm the only person who does moderation on the ibatis lists and don't want another one to manage. (NOTE: If someone wants to do that with me, let me know, it's easy, but when I'm out of the office the please subscribe emails pile up). #4 - Because of #2, people need to be seeing i3 posts now, even if they aren't using it. It'll give them an idea of when to switch (is it stable?), how to switch, and the issues they will likely encounter when they do. Finally, if no one replies to your emails in the future, don't worry about it. We still like you. It's just that your #1 priority isn't necessarily everyone else's...and judging by the chorus of me too replies on the initial post, a separate list wasn't on the top of anyone else's list. ;-) Larry On Fri, Aug 21, 2009 at 5:40 AM, Nicholoz Koka Kiknadzekikna...@gmail.com wrote: No. Lol On Fri, Aug 21, 2009 at 3:23 PM, Larry Meadors larry.mead...@gmail.com wrote: Because it's a bad idea. Happy? Larry On Fri, Aug 21, 2009 at 12:47 AM, Nicholoz Koka Kiknadzekikna...@gmail.com wrote: No reply... Seems separate list idea is soo absurd that no one bothers to explain why ;) On Tue, Aug 18, 2009 at 10:00 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: I've enjoyed much using iBatis and the mailing list was always very helpful. Well, now and then I have to search for answers in the mailing list and usually find the answer ;) So far so good. But... I've used mailing list for another framework - Tapestry for three major versions (3/4/5) and always found it very annoying not to be able to filter for which version I needed to search. Now, as questions about iBatis3 start to pore in I wondered maybe in long run it may be better to have separate mailing list for it. I don't mind subscribing to two lists - my gmail inbox will handle both ;) Wonder what others think... - 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: Feature for iBatis
...or you could turn on logging. :) On Wed, Aug 19, 2009 at 12:25 PM, Trenton D. Adamstre...@athabascau.ca wrote: Hi Guys, I thought of a feature that may be useful. iBatis, upon an SQLException, could put the entire SQL, with the parameters that were passed, into the new NestedSQLException that it throws. That way, a person could literally copy and paste the SQL out of a log file, to see what is happening. That could be an optional configuration in the configuration file. Trenton D. Adams Systems Analyst/Web Software Engineer Navy Penguins at your service! Athabasca University (780) 675-6195 :wq! __ This communication is intended for the use of the recipient to whom it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communications received in error, or subsequent reply, should be deleted or destroyed. --- - 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: updated iBatis In Action book?
On Mon, Aug 17, 2009 at 10:39 PM, Nathan Mavesnathan.ma...@gmail.com wrote: on a serious note I have some ibatis in action books for sale, get them before they get outdated Ha, I have a spare one in Korean. ;-) Free to a good home. Just swing by and pick it up, because I'm *so* not shipping it to Korea... Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Request for input on porting iBatis XML from 2.x to 3.0
Thanks for sharing! You rock. Larry On Tue, Aug 18, 2009 at 3:20 PM, Joel Barciauskasjbarciaus...@nexaweb.com wrote: Hey everyone, I just posted the notes that I took as I worked on porting my 2.x XML mapping and configuration files to the wiki: http://opensource.atlassian.com/confluence/oss/display/IBATIS/Porting+sqlMapConfig+and+sqlMap+XML+from+2.x+to+3.0 I canceled the port part-way through since I didn’t think I’d be able to finish and test it in a reasonable amount of time for my current project, but I thought the notes that I took might be useful for bootstrapping some documentation, so I went ahead and created this page. If you are familiar with the 3.0 schema, please review it, as I am sure there are items that are incorrect. Hope someone finds this of value! __ Joel Barciauskas | Technical Consultant Nexaweb Technologies | www.nexaweb.com 781.345.5428 o | 617.899.8273 m Skype™: jbarciauskas - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Who wants to write JPetStore 6 (or any other example)?
That is a great idea! I wish i had more time to do it :) Larry On Thu, Aug 13, 2009 at 3:32 PM, Clinton Beginclinton.be...@gmail.com wrote: Why don't you all implement it however you like, then we'll have a vote on the best implementation. That would be awesome. iBATIS PetStore 6 Competition -- Go! Clinton On Thu, Aug 13, 2009 at 3:30 PM, Steven A traderj1...@gmail.com wrote: My original reply was offering to take care of this if it was alright to do it in spring and springmvc, since no one else is jumping at the chance. Not that I want to get into an argument about frameworks. for me spring and springmvc was the 'path of least resistance' for me to take care of this in the shortest amount of time. I contribute to a few other projects and would rather contribute to those, or look for low hanging fruit to start contributing to the core of iBatis rather than listen to folks tell me which DI framework / web framework is 'the best' for a basic sample app I'm offering to take care of. On Thu, Aug 13, 2009 at 2:24 PM, Warren Bell warrenbe...@gmail.com wrote: Stripes? Is it popularity or simplicity? Warren Kai Grabfelder wrote: I would rather go for Stripes + Spring ;-) --- Original Nachricht --- Absender: Nathan Maves Datum: 13.08.2009 22:54 My vote is guice(DI) with stripes as the controller and jQuery UI for the front end. On Thu, Aug 13, 2009 at 2:25 PM, Steven A traderj1...@gmail.com wrote: I'm not really opposed to wicket, but springmvc is just what I have been working with for the past 2 years when I've done web work, so obviously I'm more comfortable there. Not to be a complainer, but I'm not really looking to learn anymore web frameworks at the moment. On Thu, Aug 13, 2009 at 1:22 PM, Warren Bell warrenbe...@gmail.comwrote: How about Spring and Wicket? Steven A wrote: Would you be opposed to: Spring for dependency injection Spring-mvc for the web framework On Thu, Aug 13, 2009 at 5:49 AM, Clinton Begin clinton.be...@gmail.commailto: clinton.be...@gmail.com wrote: Hi all, If anyone would like to write JPetStore 6, please let me know. Key things to do: * Upgrade it to iBATIS 3 * Ditch the DAO layer entirely * Ditch the proprietary web framework * Fix my very poor CSS and reskin the look * Use Stripes as the web framework * Use Guice for Dependency Injection (a Mapper Provider would work very well in Guice!) That said, if you have another example you would like to donate to the project, that's great. We'll review all submissions, and they'll become part of the iBATIS project. Read this about source contributions: http://www.apache.org/licenses/icla.txt You will get full credit and a link to your website (pending content review) on our team page in the thanks section. Of course, the other way is to just create your own project anywhere you like, do it however you like, and maintain your own rights and license -- we'd be happy to link to you. Cheers, Clinton -- Thanks, Warren Bell - 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: Who wants to write JPetStore 6 (or any other example)?
Even if..? I'd say ESPECIALLY IF ... We'd never have to answer How do you ibatis with _? again! :D Larry On Thu, Aug 13, 2009 at 3:35 PM, Brandon Goodinbrandon.goo...@gmail.com wrote: LOL... I'm mostly playing. I hope we can all have fun with this. Spring is certainly a fine enough solution. In then end isn't about who is willing to do it. No need to ask permission. Just do it. Even if we have 10 JPetStores implemented with 10 different frameworks it's all good. Brandon On Thu, Aug 13, 2009 at 4:30 PM, Steven A traderj1...@gmail.com wrote: My original reply was offering to take care of this if it was alright to do it in spring and springmvc, since no one else is jumping at the chance. Not that I want to get into an argument about frameworks. for me spring and springmvc was the 'path of least resistance' for me to take care of this in the shortest amount of time. I contribute to a few other projects and would rather contribute to those, or look for low hanging fruit to start contributing to the core of iBatis rather than listen to folks tell me which DI framework / web framework is 'the best' for a basic sample app I'm offering to take care of. On Thu, Aug 13, 2009 at 2:24 PM, Warren Bell warrenbe...@gmail.com wrote: Stripes? Is it popularity or simplicity? Warren Kai Grabfelder wrote: I would rather go for Stripes + Spring ;-) --- Original Nachricht --- Absender: Nathan Maves Datum: 13.08.2009 22:54 My vote is guice(DI) with stripes as the controller and jQuery UI for the front end. On Thu, Aug 13, 2009 at 2:25 PM, Steven A traderj1...@gmail.com wrote: I'm not really opposed to wicket, but springmvc is just what I have been working with for the past 2 years when I've done web work, so obviously I'm more comfortable there. Not to be a complainer, but I'm not really looking to learn anymore web frameworks at the moment. On Thu, Aug 13, 2009 at 1:22 PM, Warren Bell warrenbe...@gmail.comwrote: How about Spring and Wicket? Steven A wrote: Would you be opposed to: Spring for dependency injection Spring-mvc for the web framework On Thu, Aug 13, 2009 at 5:49 AM, Clinton Begin clinton.be...@gmail.commailto: clinton.be...@gmail.com wrote: Hi all, If anyone would like to write JPetStore 6, please let me know. Key things to do: * Upgrade it to iBATIS 3 * Ditch the DAO layer entirely * Ditch the proprietary web framework * Fix my very poor CSS and reskin the look * Use Stripes as the web framework * Use Guice for Dependency Injection (a Mapper Provider would work very well in Guice!) That said, if you have another example you would like to donate to the project, that's great. We'll review all submissions, and they'll become part of the iBATIS project. Read this about source contributions: http://www.apache.org/licenses/icla.txt You will get full credit and a link to your website (pending content review) on our team page in the thanks section. Of course, the other way is to just create your own project anywhere you like, do it however you like, and maintain your own rights and license -- we'd be happy to link to you. Cheers, Clinton -- Thanks, Warren Bell - 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: Who wants to write JPetStore 6 (or any other example)?
Mark? On 8/13/09, Steven A traderj1...@gmail.com wrote: well now that you've nixed the requirements, I'll get started on JCallGirlStore tonight fukkes! spring + springmvc + freemarker + prototype + boobies = goodness On Thu, Aug 13, 2009 at 2:37 PM, Larry Meadors larry.mead...@gmail.comwrote: Even if..? I'd say ESPECIALLY IF ... We'd never have to answer How do you ibatis with _? again! :D Larry On Thu, Aug 13, 2009 at 3:35 PM, Brandon Goodinbrandon.goo...@gmail.com wrote: LOL... I'm mostly playing. I hope we can all have fun with this. Spring is certainly a fine enough solution. In then end isn't about who is willing to do it. No need to ask permission. Just do it. Even if we have 10 JPetStores implemented with 10 different frameworks it's all good. Brandon On Thu, Aug 13, 2009 at 4:30 PM, Steven A traderj1...@gmail.com wrote: My original reply was offering to take care of this if it was alright to do it in spring and springmvc, since no one else is jumping at the chance. Not that I want to get into an argument about frameworks. for me spring and springmvc was the 'path of least resistance' for me to take care of this in the shortest amount of time. I contribute to a few other projects and would rather contribute to those, or look for low hanging fruit to start contributing to the core of iBatis rather than listen to folks tell me which DI framework / web framework is 'the best' for a basic sample app I'm offering to take care of. On Thu, Aug 13, 2009 at 2:24 PM, Warren Bell warrenbe...@gmail.com wrote: Stripes? Is it popularity or simplicity? Warren Kai Grabfelder wrote: I would rather go for Stripes + Spring ;-) --- Original Nachricht --- Absender: Nathan Maves Datum: 13.08.2009 22:54 My vote is guice(DI) with stripes as the controller and jQuery UI for the front end. On Thu, Aug 13, 2009 at 2:25 PM, Steven A traderj1...@gmail.com wrote: I'm not really opposed to wicket, but springmvc is just what I have been working with for the past 2 years when I've done web work, so obviously I'm more comfortable there. Not to be a complainer, but I'm not really looking to learn anymore web frameworks at the moment. On Thu, Aug 13, 2009 at 1:22 PM, Warren Bell warrenbe...@gmail.comwrote: How about Spring and Wicket? Steven A wrote: Would you be opposed to: Spring for dependency injection Spring-mvc for the web framework On Thu, Aug 13, 2009 at 5:49 AM, Clinton Begin clinton.be...@gmail.commailto: clinton.be...@gmail.com wrote: Hi all, If anyone would like to write JPetStore 6, please let me know. Key things to do: * Upgrade it to iBATIS 3 * Ditch the DAO layer entirely * Ditch the proprietary web framework * Fix my very poor CSS and reskin the look * Use Stripes as the web framework * Use Guice for Dependency Injection (a Mapper Provider would work very well in Guice!) That said, if you have another example you would like to donate to the project, that's great. We'll review all submissions, and they'll become part of the iBATIS project. Read this about source contributions: http://www.apache.org/licenses/icla.txt You will get full credit and a link to your website (pending content review) on our team page in the thanks section. Of course, the other way is to just create your own project anywhere you like, do it however you like, and maintain your own rights and license -- we'd be happy to link to you. Cheers, Clinton -- Thanks, Warren Bell - 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 -- 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: updated iBatis In Action book?
Not it. On Wed, Aug 12, 2009 at 5:45 PM, tomasz brymoratomekpi...@yahoo.com wrote: Greetings! Should we expect an updated version of the iBatis In Action book anytime soon? Thanks, t - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Confirming on parameterMap versus ParameterClass
I think I wrote that part and that it is wrong. :-/ A better description of the performance is this: If you define a parameter map, the time to build the parameter map is taken at startup. If you don't define a parameter map, the time to build the parameter map is taken on the *first call* to the mapped statement that uses it. The first call to a mapped statement without a parameter map would incur a small delay as the parameter map is built. After that, it would be identical to a mapped statement with a parameter map defined. So, if you have a lot of parameter maps, you may actually experience a slight performance boost at startup by removing them, then as the application gets used, you'll see a tiny delay the *first time* a mapped statement is called as that work is done then. In either case, it's only done once. Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: PL/SQL package level variables
You can use an anonymous pl/sql block in ibatis, too. Larry On Mon, Aug 3, 2009 at 11:59 PM, Nicholoz Koka Kiknadzekikna...@gmail.com wrote: Hm, but I have used package variables at Oracle 9 times (with JDBC though, but iBatis just wraps JDBC) and it worked fine. May I ask how do you handle transactions, and may I look at the code snippet calling those procedures? On Tue, Aug 4, 2009 at 9:44 AM, CuriousMind yogeshcjad...@hotmail.com wrote: Hi Nichol, Thanks for your response. We are already using same transaction while calling these procedures. But we are not getting expected results. Nicholoz Koka Kiknadze wrote: You are quite right. Your problem is that calls to those two procedures are not in a single transaction. Include them in a single transaction and proc2 will see package level variables set in proc1. Note that executing those procs on a single connection object is not enough (i.e. you need transaction). hth On Tue, Aug 4, 2009 at 8:48 AM, CuriousMind yogeshcjad...@hotmail.comwrote: -- View this message in context: http://www.nabble.com/PL-SQL-package-level-variables-tp24802267p24802615.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 to do error handling?
Put all the code you don't want to execute in the try block. Larry On Thu, Jul 30, 2009 at 4:06 PM, Bhaarat Sharmabhaara...@gmail.com wrote: Hi guys, I have a few questions on how to handle errors that are thrown when iBatis calls the Stored Procedures. Assuming i have the following code: results_list = getSqlMapClientTemplate().queryForList(spfile.getReport, parmMap); If i have the above code then when error occurs, we see it on the screen and it looks very ugly. Also, if the error occurs in above line then code after this line is not executed. I wish to catch the error, put it in the log file and show user a page that something bad has happened. So I changed the above code to: try { results_list = getSqlMapClientTemplate().queryForList(spfile.getReport, parmMap); } catch (Exception e) { log.error(e.getMessage()); } this catches the error fine. BUT the problem is that, since I am catch the error, the code after the above call is also being executed. Which I do not want. If the error occurs in the above call then I don't want any further code to get executed. We are implementing error handling at a later stage in the application. It would have been better if the code written after the above call actually checked if something exists in results_list. But that is not the case and it would be a pain to change all the code to suit this need now. How can I do this? - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Pagination by objects
I'll put this as nicely as I can: What the heck are you talking about? Larry - 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
You should be able to, yeah. Larry On Thu, Jul 23, 2009 at 12:39 AM, Dawson Lewishardcore...@yahoo.com.br wrote: Thanks for you reply Larry, Is there a way I can get the normal Address objects ? I need to serialize those objects to XML , the extra fields in these enhanced classes will create problems when deserializing because maybe the application that will deserialize is not using iBatis. Can't I just disable lazy loading and CGLIB for performing serialization ? Regards Larry Meadors wrote: They are still Address objects, just enhanced ones. Larry On Wed, Jul 22, 2009 at 7:58 AM, Dawson Lewishardcore...@yahoo.com.br wrote: Hi , I have an object with a List property - ListAddress addresses, after iBatis populates this object the addresses fields will not contain a list of address objects but a List$$EnhancerCGLIBb$$475a4210 , according to the eclipse debugger. This only happens when lazyLoadingEnabled and enhancementEnabled are set to true. Is there anyway I can get a list of addresses (ListAddress) without disabling lazy loading or enhancement ? Best regards -- View this message in context: http://www.nabble.com/LazyLoading-and-CGLIB-return-wrong-types-tp24607048p24607048.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/LazyLoading-and-CGLIB-return-wrong-types-tp24607048p24620151.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: LazyLoading and CGLIB return wrong types
They are still Address objects, just enhanced ones. Larry On Wed, Jul 22, 2009 at 7:58 AM, Dawson Lewishardcore...@yahoo.com.br wrote: Hi , I have an object with a List property - ListAddress addresses, after iBatis populates this object the addresses fields will not contain a list of address objects but a List$$EnhancerCGLIBb$$475a4210 , according to the eclipse debugger. This only happens when lazyLoadingEnabled and enhancementEnabled are set to true. Is there anyway I can get a list of addresses (ListAddress) without disabling lazy loading or enhancement ? Best regards -- View this message in context: http://www.nabble.com/LazyLoading-and-CGLIB-return-wrong-types-tp24607048p24607048.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: weird behavior
On Wed, Jul 22, 2009 at 12:29 PM, David McReynoldsdmcreyno...@secureworks.net wrote: There are only two kinds of programming errors: stupid programmer mistakes and stupid programmer mistakes. Brandon Goodin wrote: perhaps you haven't specified a resultClass/resultMap? I've never spent a day trying to figure that one out. ;-) Larry - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: problem with insert
It's early but those look identical to me. Larry On 7/15/09, Odelya YomTov ode...@jpost.com wrote: Thank you The problem was that I had: useUnicode=yesamp;characterEncoding=utf8 instead of: useUnicode=yescharacterEncoding=utf8 in the url From: Nicholoz Koka Kiknadze [mailto:kikna...@gmail.com] Sent: Tuesday, July 14, 2009 10:13 PM To: user-java@ibatis.apache.org Subject: Re: problem with insert Try this thread: http://www.mail-archive.com/user-java@ibatis.apache.org/msg13497.html Seems similar problem was solved there GL On Tue, Jul 14, 2009 at 11:00 PM, Odelya YomTov ode...@jpost.com wrote: Hi! It's not the problem with the log file encoding. It's something is the connection between ibatis and mysql From: Nicholoz Koka Kiknadze [mailto:kikna...@gmail.com] Sent: Tuesday, July 14, 2009 9:52 PM To: user-java@ibatis.apache.org Subject: Re: problem with insert Is it possible that you just did not set your log file encoding? Kind of log4j.appender.someappender.Encoding=UTF-8 On Tue, Jul 14, 2009 at 8:40 PM, Odelya YomTov ode...@jpost.com wrote: Hi! I am trying to insert data in Hebrew into the database The table is set to utf-8. But in the log file I see: DEBUG [http-12091-Processor24] - Created connection 27901603. DEBUG [http-12091-Processor24] - {conn-10} Connection DEBUG [http-12091-Processor24] - {pstm-11} PreparedStatement: SELECT * FROM users WHERE NAME = ? AND PASSWORD = ? DEBUG [http-12091-Processor24] - {pstm-11} Parameters: [×ž× ×”×œ, ×ž× ×”×œ×™×œ×§×•×˜] DEBUG [http-12091-Processor24] - {pstm-11} Types: [java.lang.String, java.lang.String] DEBUG [http-12091-Processor24] - {rset-12} ResultSet DEBUG [http-12091-Processor24] - Returned connection 27901603 to pool. Which means that I receive rubbish. What can I do to handle it? My browser reads Hebrew all right (I wrote something in struts and I see that the messages that I get back for the user are in Hebrew) - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. -- 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: R: SqlMapClient multithread applications
You can use a single sql map client to service many threads...if that's your question. :) Larry On Tue, Jul 14, 2009 at 6:17 AM, De Gaetano Giuseppedegaet...@pitagora.it wrote: Hi all, after 2.5 years of production my application starts to have some problem. Here is the error that I am experiencing --- The error occurred while applying a parameter map. --- Check the Foo.bar-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Closed Connection My application is performing some crud operation. In order to speed-up I decided to use an Hashtable to store SqlMapClient. The previous error appears if the number of running threads increases. Otherwise I don't have any problem if I do not use any cache for SqlMapClient. Any suggestion? Thanks to all in advance Giuseppe De Gaetano -Messaggio originale- Da: De Gaetano Giuseppe [mailto:degaet...@pitagora.it] Inviato: venerdì 5 gennaio 2007 16.39 A: user-java@ibatis.apache.org; lmead...@apache.org Oggetto: R: SqlMapClient multithread applications Hi, may be I wasn't clear enough. With concurrency I meant2 threads each doing the following operations: 1. Start transaction. 2. insert row 3. insert another row 4. commit/rollback transaction In this situation is the transaction isolation guaranteed? Is there any best practice? == speed up application end avoid loading every time the same config files -Messaggio originale- Da: larry.mead...@gmail.com [mailto:larry.mead...@gmail.com] Per conto di Larry Meadors Inviato: venerdì 5 gennaio 2007 16.19 A: user-java@ibatis.apache.org Oggetto: Re: SqlMapClient multithread applications On 1/5/07, De Gaetano Giuseppe degaet...@pitagora.it wrote: If the application is multithread and each thread uses the same client will I have some problem? Should be fine. Is the iBatis engine handling the concurrency or should I care? What type of concurrency? If two threads update the same row in the database, the last one in wins. iBATIS does not and will not likely ever deal with that sort of thing. Is there any best practice? Sorry if i am being dense, but for what? Larry Da: De Gaetano Giuseppe [mailto:degaet...@pitagora.it] Inviato: venerdì 5 gennaio 2007 14.23 A: user-java@ibatis.apache.org Oggetto: SqlMapClient multithread applications Hi, I am coding a java multithread application. In my application I have the following object which needs to load the configuration files from a path not specified in the classpath end build an SqlMapClient. The Hashtable is used for: * cache the clients and avoid the building of a new SqlMapClient every time; * speed up the application avoiding to load and parse the different config files every time public class SqlMapClientConfig { private static Hashtable clients; static{ clients = new Hashtable(); } private SqlMapClientConfig(){ } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public static SqlMapClient getClient(String db, String usecase,) { String key = db + . + usecase; String path = /dat/ + db + / + usecase; if(clients.containsKey(key)) return (SqlMapClient) clients.get(key); else{ Loader loader = new Loader(path); Resources.setDefaultClassLoader(loader); Reader reader = null; try { reader = Resources.getResourceAsReader (loader, sql-map-config.xml); } catch (IOException e) { e.printStackTrace(); } SqlMapClient sqlMap = null; sqlMap = (SqlMapClient) SqlMapClientBuilder.buildSqlMapClient(reader); clients.put(key,sqlMap); return sqlMap; } } } If the application is multithread and each thread uses the same client will I have some problem? Is the iBatis engine handling the concurrency or should I care? Is there any best practice? - 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: JUnit DAO queries test OK but JUnit DAO non-queries are a mystery?
Transactions? That's my guess. Larry On Sun, Jul 5, 2009 at 7:51 PM, David Browndbr...@sexingtechnologies.com wrote: Hello iBatis dev, gurus, users and mortals, I have a very curious situation with 6 testcase methods: 4 queries and 2 non-query. The 4 queries are some form of select against a where clause and an Integer ID and the same as: select count(*) where ... The asserts for all the queries pass. On the other hand the non-queries: 1 insert and 1 update don't fail either but inspection of the database records show no change. Any ideas on how to diagnose please advise, David. - 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: queryForObject/queryForList where is the documentation for the Object parameter?
It's about specialization: The core idea with ibatis is mapping sql to java objects, and there are tools that do json and xml far better than ibatis did, so we'll focus on what we do well, and let those tools do what they do well. It will be interesting to see some integration side projects that do things like sql-xml or sql-json with other tools like XStream or JSON-lib. Larry On Thu, Jul 2, 2009 at 9:55 PM, Fred Janonfja...@gmail.com wrote: That's too bad. One more thing to do in the code. I thought that JSON and XML support would be really good to implement RESTful web services. Is there a specific reason for taking it out? Fred On Thu, Jul 2, 2009 at 21:34, Larry Meadors larry.mead...@gmail.com wrote: FYI: XML parameters and results are on the way out with ibatis 3. Larry On Thu, Jul 2, 2009 at 2:06 AM, meindertmeind...@eduflex.com wrote: Hi Fred, The XML parameter object is quite interesting, it doesn’t look like ibatis can handle a ‘XML object’ the same way as it can return a XML string object; http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636 Just a note, the XML returned from ibatis is quite limited, I personally use XStream to serialize java beans to XML (or JSON) and back to java beans meindert From: Fred Janon [mailto:fja...@gmail.com] Sent: 02 July 2009 09:53 AM To: user-java@ibatis.apache.org Subject: Re: queryForObject/queryForList where is the documentation for the Object parameter? Thanks. It seems though that there are more facets to it, like XML which is particularly interesting for RESTful services. Fred On Thu, Jul 2, 2009 at 14:49, meindert meind...@eduflex.com wrote: You can only have one input Object. For simple parameters I use a Map object; As larry said, the GRD (Get R' Done) approach to do this: MapString, Object param = new HashMapString, Object(); param.put(id, yourInt); param.put(description, yourString); In you sqlmap you can revere to these parameters like #id# and #description#, or $id$ and $description$ if you want to do a literary replacement. From: Fred Janon [mailto:fja...@gmail.com] Sent: 02 July 2009 05:59 AM To: user-java@ibatis.apache.org Subject: queryForObject/queryForList where is the documentation for the Object parameter? Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList java.util.List queryForList(java.lang.String id, java.lang.Object parameterObject, int skip, int max) throws java.sql.SQLException Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range. The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement. Parameters: id - The name of the statement to execute. parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). Where in the doc or the book is that described in more details? How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate? I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now... Thanks Fred Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00 Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09 18:07:00 - 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: queryForObject/queryForList where is the documentation for the Object parameter?
FYI: XML parameters and results are on the way out with ibatis 3. Larry On Thu, Jul 2, 2009 at 2:06 AM, meindertmeind...@eduflex.com wrote: Hi Fred, The XML parameter object is quite interesting, it doesn’t look like ibatis can handle a ‘XML object’ the same way as it can return a XML string object; http://www.mail-archive.com/user-java@ibatis.apache.org/msg13636 Just a note, the XML returned from ibatis is quite limited, I personally use XStream to serialize java beans to XML (or JSON) and back to java beans meindert From: Fred Janon [mailto:fja...@gmail.com] Sent: 02 July 2009 09:53 AM To: user-java@ibatis.apache.org Subject: Re: queryForObject/queryForList where is the documentation for the Object parameter? Thanks. It seems though that there are more facets to it, like XML which is particularly interesting for RESTful services. Fred On Thu, Jul 2, 2009 at 14:49, meindert meind...@eduflex.com wrote: You can only have one input Object. For simple parameters I use a Map object; As larry said, the GRD (Get R' Done) approach to do this: MapString, Object param = new HashMapString, Object(); param.put(id, yourInt); param.put(description, yourString); In you sqlmap you can revere to these parameters like #id# and #description#, or $id$ and $description$ if you want to do a literary replacement. From: Fred Janon [mailto:fja...@gmail.com] Sent: 02 July 2009 05:59 AM To: user-java@ibatis.apache.org Subject: queryForObject/queryForList where is the documentation for the Object parameter? Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList java.util.List queryForList(java.lang.String id, java.lang.Object parameterObject, int skip, int max) throws java.sql.SQLException Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range. The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement. Parameters: id - The name of the statement to execute. parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). Where in the doc or the book is that described in more details? How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate? I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now... Thanks Fred Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00 Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09 18:07:00 - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: unsubscribe
http://ibatis.apache.org/mailinglists.html
Re: Ibator plugin use and future plans
On Tue, Jun 23, 2009 at 8:54 AM, Jeff Butlerjeffgbut...@gmail.com wrote: Warning - heavy Eclipse acronyms follow! Why does the theme song to the Mickey Mouse show keep running through my head after reading this? ;-) Larry
Re: unsubscribe
http://ibatis.apache.org/mailinglists.html On Sun, Jun 21, 2009 at 9:00 AM, Sameeh Harfoushsameeh.harfo...@gmail.com wrote: unsubscribe
Re: Suggest that resultMap add a ignoreNotExists attribute.
Easy route: select id=s1 resultMap=xresult select a, b, null as c from x /select If you feel really, really strongly that it is added, get the source from svn and do so. :-) Larry On Thu, Jun 18, 2009 at 5:41 AM, joson yuyuqian...@gmail.com wrote: hi liangfei: i meet a situation,just like your example,i need to use the same resultmap with the two query. and currently ,is there any way to attain the aim. 2009/6/2 liangfei liangfei0...@gmail.com Suggest that resultMap add a ignoreNotExists attribute: resultMap id=xresult class=xclass ignoreNotExists=true result property=a column=a / result property=b column=b / result property=c column=c / result property=d column=d / /resultMap select id=s1 resultMap=xresult select a, b from x /select select id=s2 resultMap=xresult select a, b, c from x /select
Re: Please HELP - IBatis not throwing Unique constraint exception
Are you using ibatis dao? It rethrows them as a DaoException which is a RuntimeException, IIRC. Larry On Wed, Jun 17, 2009 at 10:59 AM, Ivan Bojeribo...@gmail.com wrote: Hi, I have a problem where IBatis never throws any of the constaint exceptions. My set-up is: - postgresql 8.3.5 - postgres JDBC type 3 driver - ibator for DAO and POJO generation I have a simple table which has an unique constraint on the column. e.g. CREATE TABLE SCHEMA_CONF.dns_suffix ( suffix VARCHAR(128) NOT NULL UNIQUE, ); The problem is that I can try to insert 'n' numbers of entries into it and they will be rejected by database (as expected), but I never get any SQLExceptions thrown back. Database logs clearly show that commit was rejected because of UNIQUE constraint violation. What am I missing? Any hints?
Re: Does ping really work?
Google is your friend: http://forums.mysql.com/read.php?39,199085,204628#msg-204628 Larry On Mon, Jun 15, 2009 at 3:39 AM, Zsolt Koppanyzkoppanyl...@intland.com wrote: Hi, I get an exception attached at the end. Here are the ibatis pool properties: Pool.MaximumActiveConnections=20 Pool.MaximumIdleConnections=5 Pool.MaximumCheckoutTime=2 Pool.TimeToWait=2 Pool.PingEnabled=true Pool.PingQuery=SELECT 1 FROM always_one_row Pool.PingConnectionsOlderThan=0 Pool.PingConnectionsNotUsedFor=5000 How is it possible getting this exception? Pool.PingConnectionsNotUsedFor is set to 5 seconds and mysql complains that last packet was sent 758278 seconds ago. As far as I understand for connections older than 5 seconds the ping command should be executed and if not successful a new connection created. I use ibatis-2.3.4.726. Does anybody have an idea? Zsolt 2009-06-14 14:31:19,167 ERROR dao.impl.ProjectDaoImpl - iBATIS exception [TP-Processor489] com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred while applying a parameter map. --- Check the findProject-InlineParameterMap. --- Check the statement (query failed). --- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was758278 seconds ago.The last packet sent successfully to the server was 758278 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:126) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:102) at com.intland.codebeamer.persistence.util.SqlMapClientWrapper.queryForList(SqlMapClientWrapper.java:345)
Re: Using a user variable in a request with MySQL
On Thu, Jun 11, 2009 at 7:42 AM, Gilles SCHLIENGERgilles.schlien...@cncc.fr wrote: SET @NUM=0; SELECT (@NUM:=...@num+1), JET_ID FROM JETON WHERE JET_FK_ABO_ID = 3; Sorry, I'm not really up on mysql - what is this supposed to do? Larry
Re: RE : Using a user variable in a request with MySQL
I see, try this: SELECT (@rownum:=...@rownum+1), JET_ID FROM JETON, (SELECT @rownum:=0) r WHERE JET_FK_ABO_ID = 3; Found it here: http://jimlife.wordpress.com/2008/09/09/displaying-row-number-rownum-in-mysql/ It might work, I don't have a mysql install handy to try it on. :-/ Larry
Re: Connection Closing Problem
Is this in a web application or standalone application? Larry On 5/30/09, Nathan Modrzewski nmodrzew...@eaglexm.com wrote: I am having a problem with my Postgresql 8.3 connections not being closed when the program is finished. Here are a few of the messages from the Postgresql log file: 2009-05-30 16:18:59 MDT [echodrive_machine @ echodrive]: LOG: unexpected EOF on client connection 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG: unexpected EOF on client connection 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG: unexpected EOF on client connection 2009-05-30 16:19:02 MDT [echodrive_machine @ echodrive]: LOG: unexpected EOF on client connection I'm sure its something I'm doing wrong. I am using Apache Dbcp for my connection pooling. I'm using IBatis 2.3.4 and Apache DBCP 1.2.2. Below is a the xml settings I use for my IBatis and DBCP setup. sqlMapConfig settings useStatementNamespaces=true cacheModelsEnabled=false enhancementEnabled=false lazyLoadingEnabled=false maxRequests=1024 maxSessions=256 maxTransactions=64 / transactionManager type=JDBC commitRequired=true property name=JDBC.DefaultAutoCommit value=false / property name=JDBC.SetAutoCommitAllowed value=false / dataSource type=DBCP property name=driverClassName value=org.postgresql.Driver / property name=url value=jdbc:postgresql://db-05.eaglexm.com:5432/${database} / property name=username value=${username} / property name=password value=${password} / property name=maxActive value=32 / property name=maxIdle value=5 / property name=maxWait value=3 / property name=validationQuery value=select id from system_settings / property name=logAbandoned value=false / property name=timeBetweenEvictionRunsMillis value=6 / property name=numTestsPerEvictionRun value=5 / property name=minEvictableIdleTimeMillis value=60 / /dataSource /transactionManager ... my sqlMap statements / includes ... /sqlMapConfig Below is some java code that uses it: Reader reader = Resources.getResourceAsReader(ibatis_map/echodrive/server/SqlMapConfig. xml); try { map = SqlMapClientBuilder.buildSqlMapClient(reader,properties); map.startTransaction(); try { // Do some selects / updates / inserts map.commitTransaction(); } finally { map.endTransaction(); } } finally { reader.close(); } If anyone has any ideas, I would appreciate it. Thanks, -- Nathan -- Sent from my mobile device
Re: MS Sql Server 2000 and access to a CHAR column
Why not just use a String? Larry On Thu, May 21, 2009 at 8:00 AM, m.montano koalin...@gmail.com wrote: Hi all, I'm developing a j2ee web application using ibatis to interact with a ms sql server 2000. I've to perform this operation: insert id=insertAnnuncioFileMD parameterClass=tsf.sara.sqlmap.AnnuncioFileMD begin transaction declare @id_audio varchar(20) set @id_audio = cast(IDENT_CURRENT('filemd') + ident_incr('filemd') as varchar) INSERT INTO filemd(fname, fsize, furl, fcdate, station_id, status, diagMask, md5sig, msgId, idaudio) SELECT #fname#, #fsize#, #furl#, #fcdate#, id,#status#, #diagMask#, #md5sig#, #msgId#, #idaudio# FROM station WHERE name = #stationName# INSERT INTO annunci(idannuncio, codloc, dataorainizioann, dataorafineann, dataorainiziorec, idaudio, msgannuncio, codmas, stannuncio, lingua) VALUES (#idannuncio#, #codloc#, #dataorainizioann#, #dataorafineann#, #dataorainiziorec#, @id_audio, #msgannuncio#, #codmas#, #stannuncio#, #lingua#) commit transaction GO /insert where stannuncio is a char type (CHAR for db and char for java) I've tried to configure a handler in this way: public class CharTypeHandlerCallback implements TypeHandlerCallback { public Object getResult(ResultGetter getter) throws SQLException { System.out.println(Inside getResult); if(getter.wasNull()) return null; return getter.getString(); } public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { System.out.println(Inside setParameter); if (parameter == null) { setter.setNull(Types.CHAR); } else { setter.setString((String)parameter.toString()); } } public Object valueOf(String s) { System.out.println(Inside valueOf); return s; } } and added it in SqlMApCOnfig as typeHandler javaType=java.lang.String jdbcType=CHAR callback=tsf.sara.sqlmap.CharTypeHandlerCallback/ When I call the insert sqlMap.insert(insertAnnuncioFileMD, annuncioFileMD) I get --- The error occurred in SARA-SqlMap.xml. --- The error occurred while applying a parameter map. --- Check the insertAnnuncioFileMD-InlineParameterMap. --- Check the parameter mapping for the 'stannuncio' property. --- Cause: java.lang.NullPointerException stannuncio is set to a 'A'. I don't see where I'm wrong, have you any suggestion? Thanx, Michela -- View this message in context: http://www.nabble.com/MS-Sql-Server-2000-and-access-to-a-CHAR-column-tp23653653p23653653.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Use isNotNull with a java.lang.String parameterClass
Yes - a map or bean is required for that. The GRD approach is to do this: MapString, String param = new HashMapString, String(); param.put(value, yourString) Crude, but effective... Larry On Wed, May 20, 2009 at 9:40 AM, Chema demablo...@gmail.com wrote: Hello: How I can to use isNotNull tag in a statement if parameterClass property is java.lang.String ? When I define isNotNull property=value# , I get an error : String hasn't got a READABLE value property ( or something like that ) Is required to pass a JavaBean parameter to use isNotNull tag ? Thanks and regards
Re: iBatis - MySQL pagination
Do it in the sql statement instead of using pagination in ibatis. Look at limit, row_count and offset here: http://dev.mysql.com/doc/refman/5.0/en/select.html You will probably need to use $substitution$ for the parameters, but surely some mysql stud can tell you more about that than I can. :) Larry
Re: iBatis - MySQL pagination
Just remember with rownum in oracle to do a subselect: select * from ( your real select here ) where rownum ... Larry On Fri, May 15, 2009 at 10:42 AM, Alin Popa alin.p...@gmail.com wrote: Bhaarat, If you're using mysql, you could do pagination using LIMIT statement, which is pretty straight forward. On Mssql - TOP (using cursors). On Oracle - ROWNUM. On Fri, May 15, 2009 at 7:14 PM, Bhaarat Sharma bhaara...@gmail.com wrote: that is a very interesting question. We were looking into doing pagination with iBatis as well but would not want a full scan on the DB but rather only get amount of rows specified by skipResults On Fri, May 15, 2009 at 12:10 PM, Alin Popa alin.p...@gmail.com wrote: Hi, I'm using iBatis with MySQL and also trying to do some pagination: return getSqlMapClientTemplate().queryForList(getAll, skipResults, maxRecords); and the getAll query: select id=getAllVJobs resultMap=simpleResult SELECT * FROM mytable /select Indeed, the pagination seems to work fine, BUT in mysql logs I see executed the entire SELECT * FROM mytable which is a full table scan. Doesn't seems very right to me. Is there a catch behind this idea ? Is fetching all records and after that iterate through them ? (I don't think it's very nice this way). Any ideas ? Thanks. Alin -- Best Regards, Alin