RE: Extending IBATIs

2007-07-27 Thread Daniel Pitts
Does iBATIS use Introspector and BeanInfo? If it does (and it should!), then you can create a custom BeanInfo class that defines the getter/setter methods for particular properties. From: Clinton Begin [mailto:[EMAIL PROTECTED] Sent: Friday, J

RE: Mapping reuslt to to java.util.Map with dynamic key(from column), possible?

2007-04-05 Thread Daniel Pitts
I think its called queryForMap :-) From: Mikael Andersson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 6:28 AM To: user-java@ibatis.apache.org Subject: Mapping reuslt to to java.util.Map with dynamic key(from column),

RE: Moving sqlmap files to /WEB-INF/sqlmaps/ instead of in the classpath

2007-04-04 Thread Daniel Pitts
On Wed, Apr 4 2007, Jared Blitzstein wrote: > Is it possible to move the sqlmap xml files to a subdirectory > in the / WEB-INF/ of my web app? I'm trying not to mix xml > files in my class files and thought this might be a cleaner > approach. Everything I've found so far mentions about them > b

RE: No writeable property in class. Bug? Strange work arounds.

2007-04-02 Thread Daniel Pitts
Its my understanding that you're property name should start with a lowercass letter, not an uppercase letter. getMyProperty() will get the "myProperty" property. There is no "MyProperty", and no way to create one, short of implementing a BeanInfo class. Who wants to do that? And I don't think iBA

RE: Anemic Domain Model and iBatis

2007-04-02 Thread Daniel Pitts
This is something I've often thought about in regards to ANY ORM. iBATIS and Hibernate. I've come up with two solutions. One, add behavior to your POJOs, and ask that consumers of your classes don't use the getters/setters which iBATIS uses. Two, Create behavior rich classes which hold/own the dat

RE: conditionally add a table to the from clause just once if either or both of two parameters is not empty

2007-02-22 Thread Daniel Pitts
Perhaps moving that logic out of your xml file into Java land. Assuming you have a Map as the parameter. boolean useSupplierForParts = Boolean.valueOf(parameters.containsKey("supplierCompanyId") || parameters.containsKey("supplierRef)); Parameters.put("supplierTable", useSupplierForParts ? ", s

RE: how to create

2007-02-14 Thread Daniel Pitts
It looks like his problem is that every row adds a , which is incorrect behavior. But, It could also be that his CustomRowHandler is incorrectly implemented. From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 14, 2007 2:20 PM To: user-java@ib

RE: who's using it?

2007-02-13 Thread Daniel Pitts
Off the record, CNET is using it for certain applications. -Original Message- From: Mark Volkmann [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 13, 2007 9:22 AM To: user-java@ibatis.apache.org Subject: who's using it? You know how when you propose using some new software library and

RE: Map nullValue to empty collection

2007-02-09 Thread Daniel Pitts
Depending on whether you need to be able to "add/remove" from the Objects list after its set: public void setObjects(List objects) { this.objects = objects == null ? Collections.emptyList() : objects; } // or public void setObjects(List objects) { this.objects = objects == null ? new Arra

Iterating through Collection.

2007-02-07 Thread Daniel Pitts
I'm passing in a Collection in the parameter map. This allows me to pass in a Set, but ibatis doesn't seem to handle this: com.ibatis.common.beans.ProbeException: The 'ids' property of the java.util.HashMap class is not a List or Array. Seems like a possible bug?

RE: cannot write to property without a setter

2007-02-06 Thread Daniel Pitts
Injection using blah.getFoo().setBar(bar); should be fine. There isn't any setFoo, but its not a private injection. From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 06, 2007 12:31 PM To: user-java@ibatis.apache.org Subject: Re: cannot write t

RE: Getting straight at the ResultSet

2007-01-04 Thread Daniel Pitts
iBATIS is used to wrap JDBC, so that you don't have to deal with the low level details. If you want to deal with the low level details, simply don't use iBATIS. You are going to have an overhead if you use wrapper, but the overhead is probably minimal. Do things the normal iBATIS way, and if yo

RE: Turning Off Ibatis SQL Mapper info..

2006-11-01 Thread Daniel Pitts
Turn logging level to WARN? From: Urban, John [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 01, 2006 12:19 PMTo: user-java@ibatis.apache.orgSubject: Turning Off Ibatis SQL Mapper info.. Cannot figure out how to turn off logging. Not set it conf/log4j.xml of jboss or WEB-INF/log4j.p

RE: Problem addressing list index in a parameter declaration

2006-10-30 Thread Daniel Pitts
Looks like a problem with the way ibatis handles collections. Is it possible to iterate over the addresses, rather than manually select [0] and [1]? Also, might it be better design (if there is always going to be exactly two) to have them be individual properties? streetAddress, apartmentAddress?

RE: Flushing of oscache in a cluster ?

2006-09-21 Thread Daniel Pitts
We ran into a similar problem (same situation) Although, we happened to have an RMI connection between the tool and front-end, so we used that to send "flush" commands. I wouldn't recommend that though, trying to keep the two synchronized was a pain.   Actually, I don't know much about iBATI

RE: Postgresql serial type problem

2006-09-20 Thread Daniel Pitts
I would guess that you should omit event_id.  Instead setting it in your java code to the return valid of the insert() method. From: Okan Çetin [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 20, 2006 5:08 PMTo: user-java@ibatis.apache.orgSubject: Postgresql serial type problem I hav

RE: dynamic tables names in query problem

2006-09-19 Thread Daniel Pitts
Your iterate tag needs to specify what its iterating. I forget off the top of my head, but I think it's the value attribute. " select * from task_url_$values[]$" -Original Message- From: Eugeny N Dzhurinsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 19, 2006 6:33 AM To: user-java

RE: underscore in java bean property

2006-09-13 Thread Daniel Pitts
Even if they don't follow the spec, here is a work around: Create a object wrapper that DOES follow the spec, and it just delegates to the legacy object. If you can, however, I would refactor it to be more appropriate for modern coding practices. -Original Message- From: Nathan Maves [ma

RE: Populating existing beans...

2006-09-12 Thread Daniel Pitts
e.org Subject: RE: Populating existing beans... On Tue, 2006-09-12 at 13:49 -0700, Daniel Pitts wrote: > To clarify more, > I have a bunch of beans of different classes. There is a table for > each class of bean, with columns that correspond directly to bean > properties. This ma

RE: Populating existing beans...

2006-09-12 Thread Daniel Pitts
From: Daniel Pitts [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 12, 2006 1:42 PMTo: user-java@ibatis.apache.orgSubject: RE: Populating existing beans... Thanks for the reply.  I'm well aware of queryForMap, but the problem isn't grouping the objects.   Basically, I have a bean &

RE: Populating existing beans...

2006-09-12 Thread Daniel Pitts
Thanks for the reply.  I'm well aware of queryForMap, but the problem isn't grouping the objects.   Basically, I have a bean "graph" (or tree, or whatever) that has been constructed before there is enough information to run the final query. Also, I don't know the bean class before hand (and d

Populating existing beans...

2006-09-12 Thread Daniel Pitts
I have a Map byId; Which was built by "byId.put(myBean.getId(), myBean);" MyBean is the base class, there are many types of "MyBean" objects. Is there a away to tell iBATIS to use the bean in "byId" map as the result object? Or do I have to get the result, and copy the values over myself? I know

RE: select statement problem

2006-09-08 Thread Daniel Pitts
Try executing the query manually in an sql client. Do you get any results? If not, thats your problem. Also, make sure you're using namespaces properly. From: Okan Çetin [mailto:[EMAIL PROTECTED] Sent: Friday, September 08, 2006 1:12 PMTo: user-java@ibatis.apache.orgSubject: select stateme

RE: xml parser errors

2006-09-08 Thread Daniel Pitts
If you read carefully, you'll see that there is no WRITEABLE property named "Firstname" in class "com.domain.User" This means that your com.domain.User class doesn't have a "setFirstname" method. Also, the property should be start with lowercase, e.g. "firstname".   From: Okan Çetin [mailt

HashMaps, groupBy, error!

2006-08-24 Thread Daniel Pitts
I'm having a hard time with groupBy and hashmaps. I'm getting an exception: "Error instantiating collection property for mapping 'blog'. Cause: java.lang.ClassCastException: java.lang.Object" I call queryForMap("getBlogAndCategoriesForContent", parameters, "blog", "category"); When my query comple

RE: Update query

2006-08-24 Thread Daniel Pitts
I think his parameter class has a property named "track" which is a bean with a property named "id".   Anyway, I would probably debug (either set a break point, or just println) the value of track and track.getId() before calling this query. From: puneet arya [mailto:[EMAIL PROTECTED] Sent

M:N question

2006-08-23 Thread Daniel Pitts
I have something like the following: class Foo { Integer fooId; String name; Map> bar = new HashMap>(); // getters/setters bellow. } Table foo has (fooId, name) and table barMap has (fooId, a, b) SELECT * from foo join barMap using (fooId) WHERE fooId = #fooId#

RE: CDATA inside or outside of statement tag

2006-08-23 Thread Daniel Pitts
utside of statement tag I tend to not use them at all. The only time I would need them is for the standard less then or greater then symbols. Instead I just use the html code to do this. > and < On 8/23/06, Daniel Pitts <[EMAIL PROTECTED]> wrote: > > > I believe the cda

RE: CDATA inside or outside of statement tag

2006-08-23 Thread Daniel Pitts
I believe the cdata start/end will cause the dynamic tags to be escaped, and therefor not interpreted by iBATIS. I would guess your second suggestion is the correct one. From: Mississippi John Hurt [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 1:01 PMTo: user-java@ibatis.apach

RE: dynamic script's

2006-08-23 Thread Daniel Pitts
ink it's better to start a transaction and make multiple calls to the different insert statements.  More portable, and probably more maintainable.   Jeff Butler   On 8/23/06, Daniel Pitts <[EMAIL PROTECTED]> wrote: Is there a way to run an SQL "script" from iBATIS?Suc

dynamic script's

2006-08-23 Thread Daniel Pitts
Is there a way to run an SQL "script" from iBATIS? Such as: INSERT INTO foo (#bar#, #baz#); INSERT INTO ho (#hum#); Also, if there is, is it possible to dynamically generate the SQL to do so? Eg: INSERT INTO foo (#bar#, #baz#); INSERT INTO ho (#bar#, #hos[]#); Thanks.

Map from id->list

2006-08-14 Thread Daniel Pitts
I have a table that looks something like this: external_maps Parent externalId type 1 1 1 1 2 1 1 3 1 1 8 2 1

RE: IBATIS error...

2006-07-28 Thread Daniel Pitts
Perhaps the JUnit test is using a different sqlMap xml file? Check and see. If it is, make sure that the JUnit's sqlMap xml file is valid/correct. -Original Message- From: Henry Lu [mailto:[EMAIL PROTECTED] Sent: Friday, July 28, 2006 11:05 AM To: user-java@ibatis.apache.org Subject: IBA

RE: SQL request with optional "where"

2006-06-14 Thread Daniel Pitts
Try the ibatis website? http://ibatis.apache.org/dotnetdownloads.cgi -Original Message- From: xianwinwin [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 1:46 PM To: user-java@ibatis.apache.org Subject: Re: SQL request with optional "where" thank you larry, could you kindly poi

RE: One query populating *multiple* lists per object returned

2006-05-11 Thread Daniel Pitts
Honestly, the solution I would choose is very different Make a "Pets" table that has both dog and cat :-)   Or, if you must use this schema... When you query for people, do one query for "People with Cats", and one for "People with Dogs" and then merge the results.       From: Jeff But

Table alias in results map.

2006-03-29 Thread Daniel Pitts
I want to perform a query like: Select * FROM data AS `root:data` JOIN other AS `root:other` JOIN something as `root:other:something` WHERE $where$ The tables "data", "other", and "something" may or may not have similarly named columns. The aliases correspond to bean's in a map. ---CODE--- Map

RE: Unary conditional problem

2006-03-23 Thread Daniel Pitts
It looks to me like the selectKey isn't allowed to be dynamically used. You might have to make two separate cases, and compare documentId in java code. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 23, 2006 3:23 PM To: ibatis user list Subject

Dynamic query woes.

2006-03-23 Thread Daniel Pitts
I have a very generic query which has different column names, depending on what was passed to it. SELECT $columns$ FROM $from$ WHERE $where$ It works fine the first time. And it even works fine if $columns$ doesn't change. However, if $columns$ had (for instance) "my_column" in one quer

Problem with dynamic query.

2006-03-21 Thread Daniel Pitts
I'm trying the following dynamic query, and ibatis throws an exception on initialization. (Even before I call the query) The exception is a Probe exception, cannot find ordinal for JavaBean , caused by NumberFormatException from string "". Can anyone tell me what I'm doing wrong? Query:

queryForMap and lists...

2006-03-20 Thread Daniel Pitts
I want to perform query and map the results by a specific column... The rows may have non-unique values for the specified column, and I'd like to have it build a list if possible. Any ideas?

RE: Re: HashMap results and column aliased with '.' in the name.

2006-03-17 Thread Daniel Pitts
@ibatis.apache.org Subject: Re: HashMap results and column aliased with '.' in the name. You can remap in sql w/ "as" or map the fields in XML. .V Daniel Pitts wrote: > I want to get a result back as a HashMap with all the columns in the > result being keys in the map.

HashMap results and column aliased with '.' in the name.

2006-03-17 Thread Daniel Pitts
I want to get a result back as a HashMap with all the columns in the result being keys in the map. It makes sense for my application to have '.'s in the column names, but ibatis is trying to map those to properties of "Object" instances. Is there any way to tell ibatis to ignore '.'s in the column