Hello List,
Is possible to choose what List implementation is returned when
queryForList(...) is called.
For example, suppose I have my own list implementation that extends
ArrayList. Can I do the following
MyCustomList lst = (MyCustomList)queryForList("myQuery",
params);
Currently what I do is
MyCustomList lst = new MyCustomList(queryForList("myQuery",
params));
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Be careful with lazy loading 1-1 relationships where the lazy loaded
result could be null. A proxy object will be in its place.
e.g.
if ( foo.getBar() == null ) { // Bar is lazy loaded.
// Unreachable code
}
From: Poitras Christian [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 12 September 2007 4:05 AM
To: user-java@ibatis.apache.org
Subject: RE: Lazy Load is pre loading 1-1 relationships
It seems that is works with my classes.
I don't use
private static final long serialVersionUID = -1699855014908794446L;
I use.
static final long serialVersionUID = 7213712437136303104L;
Give it a try!
Christian
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, 11 September 2007 15:57
To: user-java@ibatis.apache.org
Subject: RE: Lazy Load is pre loading 1-1 relationships
That was it! I removed the variable definition from all my domain
objects, performed a clean and build and the lazy loading is now working
correctly. Thanks for the suggestion.
[EMAIL PROTECTED]
09/11/2007 12:30 PM
Please respond to
user-java@ibatis.apache.org
To
user-java@ibatis.apache.org
cc
user-java@ibatis.apache.org
Subject
RE: Lazy Load is pre loading 1-1 relationships
This may actually answer my question. I recently added to my domain
objects the following:
private static final long serialVersionUID = -1699855014908794446L;
I added this to eliminate the warning that Eclipse was giving me. Any
object that I needed to touch as of recently I would add this to. The
domain objects that are not lazily loading seem to be the ones that I
added serialVersionUID to.
Thanks for the help...
"Poitras Christian" <[EMAIL PROTECTED]>
09/11/2007 12:22 PM
Please respond to
user-java@ibatis.apache.org
To
cc
Subject
RE: Lazy Load is pre loading 1-1 relationships
I doubt my reply will answer your question, but this is mostly for
information purpose.
All final classes are never lazy loaded by iBATIS. This include any
primitive type, Strings and this like Integer, Double, etc...
This "bug" is probably due to the fact that cglib tries to extend the
class. If it is final, it must be loaded now.
Christian
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, 11 September 2007 15:12
To: user-java@ibatis.apache.org
Subject: Lazy Load is pre loading 1-1 relationships
I've been spending a fair amount of time on this now but I can't seem to
get any further. Objects that I am attempting to load lazily are simply
loading. The relationships that are 1-M seem to be fine, meaning that
they are not pre-loading, but any relationship that I have that is a 1-1
seems to be loaded when the resultSet is applied to the parent object.
Is there anything I can do to prevent this from happening?
Thanks...
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
If the sub classes have a common setter method then its possible the use the
that setter as the required single result in the result map. As you interface
will not have setters you'll have to use any one of the sub classes
(BlackSomething or WhiteSomething) as the "class" attribute in the main result
map. The calling java code can do the cast to Isomething interface.
E,g.
Paul
-Original Message-
From: Ilya Boyandin [mailto:[EMAIL PROTECTED]
Sent: Monday, 3 September 2007 4:39 PM
To: user-java@ibatis.apache.org
Subject: Using discriminator with an interface
Hello all,
is that possible to use discriminator with an interface without setters?
I have something like this in my mappings:
...
...
...
And I always get this RuntimeException: "resultMap Something.somethingResult
must have at least one result mapping". But somethingResult can't have any
mappings because ISomething is an interface without any setters.
Am I doing something wrong or is there any other way to accomplish this?
Thanks in advance
Ilya
FH JOANNEUM Gesellschaft mbH
Rechtsform/Legal form: GmbH
Firmenbuchgericht/Court of registry: Landesgericht für ZRS Graz
Firmenbuchnummer/Company registration: FN 125888 f
DVR: 0813559
UID-Nr.: ATU 42361001
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Dear List,
I'm using lazy loading for inner select statements in results maps. Is
it possible to hard code a parameter that's passed to the inner select
statement. See below. I would like the string "BIG_SPENDER" to be
passed to the query getOrderPayments. Is this possible?
select ORD_ID, ORD_CST_ID
from PAYMENT
where PAY_ORD_ID = #itemId#
and PAY_CST_TYPE = #custType#
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Ibatis can use the private methods.
E.g. If you define the method as "private void setId(Integer id) {..}"
then ibatis can call it.
Hope this helps,
Paul
-Original Message-
From: Gordon Ross [mailto:[EMAIL PROTECTED]
Sent: Monday, 7 May 2007 3:24 PM
To: user-java@ibatis.apache.org
Subject: How to support read-only fields/paramters
(This may not be totally iBatis realated, I'm not sure. Feel free to
point me elsewhere)
Often when working with objects, you have fields that should never be
changed (e.g. an "id" field which is generated by the database). The
usual way (as I understand it) that you achieve this, is to specify the
parameter value in the objects constructor, and only provide a get()
method, with no corresponding set() method (or a final private one so
that it can't be over-ridden)
However, iBatis does not use the parmaterised constructor to build an
object. Instead, it uses the null constructor, and then calls the
individual set() methods - which have to be public for iBatis to be able
to call them. This means that anyone could call the set() method and
change the value.
There are two ways that I can see to achieve this:
1) Only allow the set() method to be called once. (Use some internal
boolean flag to see if it the set() method has been called before)
2) Somehow configure/change iBatis so that it would use the constructor
to set the request fields.
Anyone got any thoughts or comments on this ?
Thanks,
GTG
Gordon Ross,
Network Manager/Rheolwr Rhydwaith
Countryside Council for Wales/Cyngor Cefn Gwlad Cymru
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Yes, create the JIRA please.
-Original Message-
From: Daigo Kobayashi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 11 April 2007 10:41 PM
To: user-java@ibatis.apache.org
Subject: Re: Lazy load and serializable
Hi,
Thank you for replying.
I know it is possible, if I modify iBatis' source code. But if I modify
iBatis' source code, I have to maintain it. So if possible, I want to
avoid it.
So should I create jira?
MCCORMICK, Paul wrote:
> You'll need to modify the ibatis source code. If your not using cglib
> then you only need to make the class LazyResultLoader serializable.
>
> This is done in 3 easy steps.
> 1) Add implements Serializable to the LazyResultLoader class
> definition
> :)
> 2) Make the private field ExtendedSqlMapClient client transient.
> 3) Insert your own code to set the ExtendedSqlMapClient client field
> on deSerialization.
>
> I've attached my version of LazyResultLoader.java
>
> Hope this helps,
> Paul
>
> -Original Message-
> From: Daigo Kobayashi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 10 April 2007 10:11 PM
> To: user-java@ibatis.apache.org
> Subject: Lazy load and serializable
>
> I'm using 1:N mapping with lazy load option.
> iBatis create not serializable object, so it can't store in some
> conditions. (I'm using Spring Web Flow and iBatis, serializable object
> is required by Spring Web Flow.)
>
> Is there any good way to resolve this?
>
>
> "DISCLAIMER: This email, including any attachments, is intended only
for use by the addressee(s) and may contain confidential and/or personal
information and may also be the subject of legal privilege. If you are
not the intended recipient, you must not disclose or use the information
contained in it. In this case, please let me know by return email,
delete the message permanently from your system and destroy any copies.
>
> Before you take any action based upon advice and/or information
contained in this email you should carefully consider the advice and
information and consider obtaining relevant independent advice.
You'll need to modify the ibatis source code. If your not using cglib
then you only need to make the class LazyResultLoader serializable.
This is done in 3 easy steps.
1) Add implements Serializable to the LazyResultLoader class definition
:)
2) Make the private field ExtendedSqlMapClient client transient.
3) Insert your own code to set the ExtendedSqlMapClient client field on
deSerialization.
I've attached my version of LazyResultLoader.java
Hope this helps,
Paul
-Original Message-
From: Daigo Kobayashi [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 10 April 2007 10:11 PM
To: user-java@ibatis.apache.org
Subject: Lazy load and serializable
I'm using 1:N mapping with lazy load option.
iBatis create not serializable object, so it can't store in some
conditions. (I'm using Spring Web Flow and iBatis, serializable object
is required by Spring Web Flow.)
Is there any good way to resolve this?
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
LazyResultLoader.java
Description: LazyResultLoader.java
I'll give you some of the sudo code that I used to overcome lazy loading
of 1 to 1 relationships. I had to write extra code to allow lazy loaded
objects to be serializable and cloneable. The code has nothing to do
with lazy loading of lists.
All objects loaded from the database implement the IBaseDomain
interface.
interface IBaseDomain {
Integer id // The primary key which is never null
Integer versionId // Used of optomistic locking
boolean setNewCalled // Used when the id and versionId have been set
to null by client code.
}
Here is the ResultObjectFactory used. Quite simple, just enhances
anything that implements IBaseDomain.
public final class EmitsResultObjectFactory implements
ResultObjectFactory {
public final Object createInstance(String arg0, Class clazz) throws
InstantiationException, IllegalAccessException {
if (IBaseDomain.class.isAssignableFrom(clazz)) {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(clazz);
enhancer.setCallbackFilter(EnhancedBaseDomainCallbackFilter.instance);
enhancer.setCallbacks(EnhancedBaseDomainCallbackFilter.callbacks);
return enhancer.create();
} else {
return null;
}
}
public void setProperty(String arg0, String arg1) {}
}
---
public final class EnhancedBaseDomainCallbackFilter implements
CallbackFilter, MethodInterceptor, Serializable {
private EnhancedBaseDomainCallbackFilter() {
}
public static final EnhancedBaseDomainCallbackFilter instance = new
EnhancedBaseDomainCallbackFilter();
public static final Callback[] callbacks = { NoOpCallback.INSTANCE,
instance };
public final int accept(Method method) {
if (method.getName().startsWith("get") &&
method.getParameterTypes().length == 0 &&
IBaseDomain.class.isAssignableFrom(method.getReturnType())) {
return 1; // BaseDomain return types are intercepted.
}
return 0; // the No operation interceptor. Does nothing.
}
/**
* Allows using the enhancementEnabled ibatis option. This option
allows the lazy loading of single objects ( and not just Lists ).
*
* e.g the following method can be lazy loaded: public Party
getParty();
*
* A problem occurs if calling the "public Party getParty()" should
return null. Instead of null being returned a 'wrapped null' is
returned. This MethodInterceptor fixes this
* feature/bug.
*/
public final Object intercept(final Object object, final Method
method, final Object[] args, final MethodProxy proxy) throws Throwable {
Object obj = proxy.invokeSuper(object, args);
if ((obj == null) || (!(obj instanceof IBaseDomain))) {
return obj;
}
IBaseDomain baseDomain = (IBaseDomain) obj;
// All Enhanced objects implement Factory.
if (baseDomain instanceof Factory) {
// If the primary key is null then the object is null unless
the client code called setNew()
if (baseDomain.getId() == null) {
try {
// If baseDomain.setNew() is called then the object
is valid. If not then its a return null instead of the proxy.
if (!baseDomain.isSetNewCalled()) {
return null;
}
// There is a bug in cg lib that can cause a Null
Pointer to be thrown on a cloned enhanced object. Don't know why but
this is a temp fix.
} catch (NullPointerException e) {
Log log =
LogFactory.getLog(EnhancedBaseDomainCallbackFilter.class);
log.debug("EnhancedBaseDomainCallbackFilter.intercept caught
NullPointerException on method " + method.getName() + " object:" +
baseDomain.getClass().getName());
return null;
}
}
}
return baseDomain;
}
private interface NoOpCallback extends NoOp, Serializable {
/**
* A thread-safe singleton instance of the
NoOpCallback callback.
*/
public static final NoOpCallback INSTANCE = new NoOpCallback() {
};
}
}
---
I changed the Ibatis class EnhancedLazyResultLoader.
1) I had to make an inner class Serializable. This involved making the
field that links to the jdbc connection transient. I then had to put my
application code into this class to set this transient field. Thats a
hack that you may want to improve on.
2) Changed the EnhancedLazyResultLoaderImpl.loadResult() method to only
create proxy objects for IBaseDomain results ( that are not abstract).
The reason for not lazy loading abstract classes is because the
instanceof does not work as expected when comparing to a concrete class.
Here is the method code. I'll attach a file of the whole class also but
most of it is not re
Documentation says this is fixed in IBATIS-366. I'm downloading it now
to test.
From: MCCORMICK, Paul [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 17 January 2007 3:28 PM
To: user-java@ibatis.apache.org
Subject: Complex Property and ResultObjectFactory
I have a complex property thc in the result map below.
The object for the property is created in
ComplexBeanProbe.setObject(...) and not in my ResultObjectFactory
implementation. I'm not using the 2.2.0 beta version. Has this change
in further releases?
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for
use by the addressee(s) and may contain confidential and/or personal
information and may also be the subject of legal privilege. If you are
not the intended recipient, you must not disclose or use the information
contained in it. In this case, please let me know by return email,
delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information
contained in this email you should carefully consider the advice and
information and consider obtaining relevant independent advice.
I have a complex property thc in the result map below.
The object for the property is created in
ComplexBeanProbe.setObject(...) and not in my ResultObjectFactory
implementation. I'm not using the 2.2.0 beta version. Has this change
in further releases?
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
You could use a TypeHandler. But this would not allow you to easily
change the Calendar object that is used for the query.
E.g.
public class MyTimestampTypeHandler implements TypeHandlerCallback {
private Calendar myCalendar = null;
public Object getResult(ResultGetter arg0) throws SQLException {
Timestamp ts = arg0.getTimestamp(myCalendar);
if (arg0.wasNull())
return null;
return ts;
}
}
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Larry Meadors
Sent: Thursday, 11 January 2007 4:00 PM
To: user-java@ibatis.apache.org
Subject: Re: ResultSet ... getTimestamp with Calendar
Nope, it doesn't.
Larry
On 1/10/07, Cornel Antohi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Any answer to this question ... please?
>
> Thank you,
> Cornel
>
> - Original Message -
> From: "Cornel Antohi" <[EMAIL PROTECTED]>
> To:
> Sent: Monday, January 08, 2007 8:26 PM
> Subject: ResultSet ... getTimestamp with Calendar
>
>
> > Hi,
> >
> > I would like to ask you if iBatis offers support for the following
> > JDBC
> > function:
> >
> > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html#getT
> > imestamp(int,%20java.util.Calendar)
> >
> > Thank you,
> > Cornel
>
>
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Setting lazyLoadingEnabled to true will allow the lazy loading 1 to many
relationships. You don't have any 1 to many relationships in your code
below.
Setting enhancementEnabled to true will allow the lazy loading of 1 to
1 relationships.
From: Kuntz, Tim [mailto:[EMAIL PROTECTED]
Sent: Friday, 5 January 2007 11:24 AM
To: user-java@ibatis.apache.org
Subject: iBatis Book - Lazy Loading Description
The new iBatis book describes lazy-loading as follows (pg 131).
"To use lazy loading, we need to edit the SqlMapConfig.xml file to
enable it by changing the lazyLoadingEnabled attribute to true in the
element. If you want to use the cglib enhanced version of lazy
loading, you will want to download it, add it to your application's
classpath, and change the enhancementEnabled attribute of the
element to true as well."
After setting up a sample similar to that in the book, I noticed that
lazy-loading only appears to work correctly if BOTH lazyLoadingEnabled
and enhancementEnabled are set to true. Running the following code
executes the selects as the objects are requested.
person = sqlMapper.queryForObject("Person.selectPerson"); // runs select
... from person
person.getAddress(); // runs select .. from address
person.getAddress().getState(); // runs select .. from state
Setting enhancementEnabled to false causes all of the select statements
to execute initially. Changing lazyLoadingEnabled to false doesn't
change the behavior.
person = sqlMapper.queryForObject("Person.selectPerson"); // runs all 3
select statements
person.getAddress();
person.getAddress().getState();
Is this correct behavior? If so, when would I benefit from
lazyLoadingEnabled = "true"?
I'm using iBatis version 2.3.0.677
Thanks,
Tim
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
You need to set enhancementEnabled="true" and have cglib in you classpath.
That will cause ibatis to use EnhancedLazyResultLoader.
There is still some issues with 1:1 enhanced lazy loading.
1) If you use the tag to return 1:1 lazy loaded sub classes
then you will not be able to cast the returned object to the subclass. That's
because the proxy object returned is based on the method return type. I
changed EnhancedLazyResultLoader to not lazy load 1:1 abstract classes. This
reduced the effect of this issue.
2) If the lazy loaded object returns no results you would expect null to be
returned. Instead a proxy object is returned and calling methods on the proxy
object will return null. This was a major problem for me.
E.g. If ( foo.getBar() == null ) {
// Will never happen.
}
To get over this problem I used a custom ResultObjectFactory to add a method
interceptor which would check for the above scenario and return null if
required. I can post that code if needed. If you relationship is 1:1 this
will not be an issue by my relationships were 1 to 0 or 1
3) Its harder to debug cgi enhanced objects using GUI debuggers.
Hope this helps,
Paul
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 19 December 2006 4:04 PM
To: user-java@ibatis.apache.org
Subject: Lazy Loading
Hi,
I started using iBATIS recently and I'm trying to use the lazy loading feature
...
according the Developer Guide it is possible to lazy load (1:1) relations, but
after testing an examining the iBATIS code I have the impression lazy loading
only works for collection properties?
in the class LazyResultLoader:
public Object loadResult() throws SQLException {
if (Collection.class.isAssignableFrom(targetType)) {
InvocationHandler handler = new LazyResultLoader(client, statementName,
parameterObject, targetType);
ClassLoader cl = targetType.getClassLoader();
return Proxy.newProxyInstance(cl, LIST_INTERFACES, handler);
} else {
return ResultLoader.getResult(client, statementName, parameterObject,
targetType);
}
}
mvg,
Wouter Roose
tel.: 02 787 54 08
__
SmalS-MvM sluit elke aansprakelijkheid uit in verband met de juistheid, de
volledigheid of het tijdig toekomen van de informatie in deze e-mail. Aan deze
e-mail kunnen geen rechten worden ontleend en deze e-mail houdt in geen geval
een erkenning van welkdanige aansprakelijkheid in.
Dit bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet
voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en het
bericht te vernietigen.
SmalS-MvM décline toute responsabilité quant à l'exactitude, à l'exhaustivité
et au délai de transmission des informations contenues dans cet e-mail. Aucun
droit ne peut être revendiqué sur cet e-mail et cet e-mail n'implique en aucun
cas une reconnaissance de responsabilité, quelle qu'elle soit.
Ce message s'adresse uniquement au destinataire. Si ce message ne vous est pas
destiné, nous vous prions de nous le signaler immédiatement et de détruire le
message.
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Title: enhancementEnabled and lazyLoadingEnabled problem.
I have set enhancementEnabled="true" and lazyLoadingEnabled="true" in the SqlMapConfig
A problem exists when the lazy loaded object is null. Using the enhancementEnabled="true" option causes enhanced lazy loaded object to be returned from a getter even if the lazy query returned no rows. Calling any method on the enhanced object causes a null pointer exception.
For example. There is a 1 to 0..1 relationship between Foo and Bar.
Class Foo {
private Bar bar;
...
}
// Now here is the test that fails if set enhancementEnabled="true"
Foo foo = (Foo)queryForObject("fooWithNullBar", null);
Bar bar = foo.getBar();
assertTrue(bar == null); // FAILS!!!
If enhancementEnabled="false" then the test work. Is this a bug or have I misunderstood enhancementEnabled what the flag does? I'm using version 2.2.0.636.
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Ah that explains what I was doing
wrong.
From: Clinton Begin
[mailto:[EMAIL PROTECTED] Sent: Thursday, 21 September 2006
2:29 PMTo: user-java@ibatis.apache.orgSubject: Re:
Parameterised constructors
No, you still need to write the setter, but make it private.
Like this:
public class Foo {
private String
foo;
public String getFoo() {
return foo;
}
private void setFoo(String foo)
{
this.foo = foo;
}
}
On 9/20/06, MCCORMICK,
Paul <
[EMAIL PROTECTED]> wrote:
How do private setters work? Could I set the 'foo' property using
the result map below? Is there anything I have to do to the jmv to allow
it access to the private field?
public class Foo {
private String foo;
public String getFoo() {
return foo;
}
}
Thanks,
Paul
From: Clinton Begin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 19
September 2006 3:23 AMTo: user-java@ibatis.apache.orgSubject: Re:
Parameterised constructors
As a temporary alternative we do support private setters as of
2.2.0. Constructor injection is supported in the .NET
version. The two codebases are somewhat similar, so we could always
check on their approach to it. Clinton
On 9/18/06, Jeff
Butler <[EMAIL PROTECTED]> wrote:
I remember some folks asking about this, but no commitment to do
it. It would require quite a change to the way iBATIS processes result
sets. Translation: don't expect this anytime soon.
BTW, the Sun patterns web site has some information about an immutable
transfer object pattern here:
http://java.sun.com/blueprints/patterns/TransferObject.html
The basic idea is that you create an interface for the immutable part,
and a mutable static inner class for initializing. This does work with
iBATIS. But one warning - we used this pattern on my team for a while
and everyone (me included) HATED it. So we eventually went to simple
JavaBeans with getters AND setters.
Jeff Butler
On 9/18/06, [EMAIL PROTECTED] < [EMAIL PROTECTED] > wrote:
Mmm
... no that's not quite it.I have a set of VO classes that are
immutable. This means that all the data is added at
construction.|-+--->|
| "Larry
Meadors" ||
|
<[EMAIL PROTECTED]||
|
.org> |
|
| Sent
by:||
|
[EMAIL PROTECTED]||
| ail.com
|
|
|
||
|
| |
| 18/09/2006
13:10||
| Please
respond ||
| to
user-java||
|
|
|-+--->>---||
|
|To: user-java@ibatis.apache.org
|
|cc: (bcc:
Ray
Offiah/WRSYS/MANSERV/JLP)
| |Subject: Re:
Parameterised
constructors|
>---|
I am not finding docs for it at the moment,
either. I think that the ResultObjectFactoryTest unit test does what you
want. Take a look, and see - if it is, please feel free to add a page to
the WIKI (http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home
)on how to use it.LarryOn 9/18/06, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:>> Hi
there!>> I vaguely remember reading that parameterised
constructors were being > considered for Ibatis. Is this still
planned for a future release, or has > the idea been
dropped?>> I noticed that there was no mention of them in the
documentation for the> latest beta, which is a bit of a shame (for me
anyway; not sure how many > others would find them useful)
>>>>
**>
This email is confidential and may contain copyright material of the John
Lewis Partnership. If you are not the intended recipient, please notify
us immediately and delete all co
How do private setters work?
Could I set the 'foo' property using the result map below? Is there
anything I have to do to the jmv to allow it access to the private
field?
public class Foo {
private String
foo;
public String getFoo()
{
return
foo;
}
}
Thanks,
Paul
From: Clinton Begin
[mailto:[EMAIL PROTECTED] Sent: Tuesday, 19 September 2006
3:23 AMTo: user-java@ibatis.apache.orgSubject: Re:
Parameterised constructors
As a temporary alternative we do support private setters as of
2.2.0. Constructor injection is supported in the .NET
version. The two codebases are somewhat similar, so we could always check
on their approach to it. Clinton
On 9/18/06, Jeff
Butler <[EMAIL PROTECTED]> wrote:
I remember some folks asking about this, but no commitment to do
it. It would require quite a change to the way iBATIS processes result
sets. Translation: don't expect this anytime soon.
BTW, the Sun patterns web site has some information about an immutable
transfer object pattern here:
http://java.sun.com/blueprints/patterns/TransferObject.html
The basic idea is that you create an interface for the immutable part,
and a mutable static inner class for initializing. This does work with
iBATIS. But one warning - we used this pattern on my team for a while
and everyone (me included) HATED it. So we eventually went to simple
JavaBeans with getters AND setters.
Jeff Butler
On 9/18/06, [EMAIL PROTECTED] < [EMAIL PROTECTED] > wrote:
Mmm
... no that's not quite it.I have a set of VO classes that are
immutable. This means that all the data is added at
construction.|-+--->|
| "Larry
Meadors" ||
|
<[EMAIL PROTECTED]||
|
.org> |
|
| Sent
by:||
|
[EMAIL PROTECTED]||
| ail.com
|
|
|
||
|
| |
| 18/09/2006
13:10||
| Please
respond ||
| to
user-java||
|
|
|-+--->>---||
|
|To: user-java@ibatis.apache.org
|
|cc: (bcc:
Ray
Offiah/WRSYS/MANSERV/JLP)
| |Subject: Re:
Parameterised
constructors|
>---|
I am not
finding docs for it at the moment, either. I think that the
ResultObjectFactoryTest unit test does what you want. Take a look, and
see - if it is, please feel free to add a page to the WIKI (http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home
)on how to use it.LarryOn 9/18/06, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:>> Hi
there!>> I vaguely remember reading that parameterised
constructors were being > considered for Ibatis. Is this still planned
for a future release, or has > the idea been dropped?>> I
noticed that there was no mention of them in the documentation for the>
latest beta, which is a bit of a shame (for me anyway; not sure how many
> others would find them useful)
**>
This email is confidential and may contain copyright material of the John
Lewis Partnership. If you are not the intended recipient, please notify us
immediately and delete all copies of this message. (Please note that it
isyour responsibility to scan this message for viruses). Email to and from
the John Lewis Partnership is automatically monitored for operational and
lawful business reasons.>
**>
John Lewis plc> Registered in England 233462 > Registered
office 171 Victoria Street London SW1E 5NN >>
Websites: http://www.johnlewis.com> http://www.waitrose.com
> http://www.johnlewispartnership.co.uk>>
**
>>**This
email is confidential and may contain copyright material of the John Lewis
Partnership. If you are not the intended recipient, please notify us
immediately and d
Title: Message
If you have a nested bean then use a
nested result map. You will need to use the 2.2.0 beta release.
It wont work with 2.1.7.
Paul
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Sent: Friday, 18 August 2006 2:43
PMTo: user-java@ibatis.apache.orgSubject: Nested Bean in
Result Map
Hi,
I have a bean as
shown below.
class
PageBean{
int id;
NestedBean detail;
String name;
}
class
NestedBean{
String address1;
String address2;
}
I have table with
following columns.
ID, NAME, ADDRESS1,
ADDRESS2
How to set the
result map for the PageBean?
Thanks &
Regards,
Kiran
The information contained in
this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain proprietary,
confidential or privileged information. If you are not the intended
recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this
message and any attachments. WARNING: Computer viruses can be
transmitted via email. The recipient should check this email and any
attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this
email.www.wipro.com
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
I've tested it on my application and
it works. Thanks for the prompt fix.
Paul McCormick
From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Thursday, 3 August 2006 4:33 AMTo:
user-java@ibatis.apache.orgSubject: Re: JIRA 225 and discriminator
tag.
Hi Paul,
I have just committed a fix and unit test for this problem. Get the
new source from SVN and let me know how it works for you.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED]>
wrote:
ok, thanks. I'll leave it to you
then.
From: Jeff Butler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 2 August 2006 12:13 PM
To: user-java@ibatis.apache.orgSubject: Re: JIRA 225
and discriminator tag.
Thanks Paul. I've just coded a unit test for myself that is failing
like you described, so you don't need to provide another one unless you just
want to. I'll post further comments in JIRA after I do a
little investigation.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED] > wrote:
No problem, I'll provide the unit test.
From: Jeff Butler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 2 August 2006 11:09 AM To: user-java@ibatis.apache.orgSubject: Re: JIRA
225 and discriminator tag.
I'll take a look at this. If you can provide a reproducable test
case, it would be good to add the test case to the JIRA ticket.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED] > wrote:
Hi, I've downloaded the latest ibatis code from
SVN last week as I needed the following feature: http://issues.apache.org/jira/browse/IBATIS-225
I have encountered a problem.
The reused result map ignores the discriminator tag. I've
attached some code below. The legDiscriminatorTestFails query fails. The query should return a DisplayTenement
object containing a single Legislation object. The query
legDiscriminatorTestWorks works. This returns a single Legislation object. Both
queries use the same args and return the same db results. In the
query that fails the discriminator tag does not find a match for any
sub Maps so it defaults to using the Legislation class which is
abstract. Am I doing something wrong?
Here are the
classes: public
class DisplayTenement { private Integer
id; private Legislation
legislation; }
public abstract
class Legislation { private Integer
tenementId; }
public class
SpecialProspectingLegislation82 extends Legislation {
}
<resultMap id ="tenementLegislationRM" class=
"Legislation" > <result property="id" column="LEGISLATION_ID"/> <result property ="tenementId" column=
"TENEMENT_ID"/> <result property="effectiveRange" column="START_STMP"/> <result property ="versionId" column=
"LEGISLATION_VERSION_ID"/> < discriminator column="LEGISLATION_CODE" javaType="java.lang.String" >
<subMap value
="AMLS60"
resultMap= "Legislation.AMLS60"/>
< subMap value="CWOS80" resultMap="Legislation.CWOS80"/>
<subMap value
="CWOS94"
resultMap= "Legislation.CWOS94"/>
< subMap value="EL05NM" resultMap="Legislation.EL05NM"/>
. about 20 more subMaps ..
discriminator> resultMap
>
< sql id="legDiscriminatorTestSQL" >
SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID,
leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS
LEGISLATION_VERSION_ID
FROM EM_TENEMENT_LEGISLATION_TB leg
WHERE leg.LEGISLATION_ID = #value# sql>
< resultMap id="oneToOneTestRM" class="emits.domain.tenement.DisplayTenement" >
<result property
="id" column= "TENEMENT_ID"/>
<result property="legislation" resultMap="Legislation.tenementLegislationRM" /> resultMap>
<select id="legDiscriminatorTestFails" resultMap="oneToOneTestRM" > <include refid ="legDiscriminatorTestSQL"/> select>
<select id ="legDiscriminatorTestWorks" resultMap= "Legislation.tenementLegislationRM" >
<include refid=
"legDiscriminatorTestSQL"/>
se
ok, thanks. I'll leave it
to you then.
From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 2 August 2006 12:13 PMTo:
user-java@ibatis.apache.orgSubject: Re: JIRA 225 and discriminator
tag.
Thanks Paul. I've just coded a unit test for myself that is failing
like you described, so you don't need to provide another one unless you just
want to. I'll post further comments in JIRA after I do a little
investigation.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED]>
wrote:
No problem, I'll provide the unit test.
From: Jeff Butler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 2 August 2006 11:09 AM To: user-java@ibatis.apache.orgSubject: Re: JIRA 225
and discriminator tag.
I'll take a look at this. If you can provide a reproducable test
case, it would be good to add the test case to the JIRA ticket.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED] > wrote:
Hi, I've downloaded the latest ibatis code from SVN
last week as I needed the following feature: http://issues.apache.org/jira/browse/IBATIS-225
I have encountered a problem. The
reused result map ignores the discriminator tag. I've attached
some code below. The legDiscriminatorTestFails query
fails. The query should return a DisplayTenement object
containing a single Legislation object. The query legDiscriminatorTestWorks works. This returns a single Legislation object. Both
queries use the same args and return the same db results. In the query
that fails the discriminator tag does not find a match for any sub
Maps so it defaults to using the Legislation class which is
abstract. Am I doing something wrong?
Here are the
classes: public
class DisplayTenement { private Integer
id; private Legislation legislation;
}
public abstract
class Legislation { private Integer
tenementId; }
public class
SpecialProspectingLegislation82 extends Legislation {
}
<resultMap id ="tenementLegislationRM" class=
"Legislation" > <result property="id"
column="LEGISLATION_ID"/>
<result property
="tenementId"
column= "TENEMENT_ID"/>
<result property="effectiveRange" column="START_STMP"/> <result property
="versionId"
column= "LEGISLATION_VERSION_ID"/>
< discriminator column="LEGISLATION_CODE" javaType="java.lang.String" >
<subMap value
="AMLS60" resultMap= "Legislation.AMLS60"/>
< subMap value="CWOS80"
resultMap="Legislation.CWOS80"/>
<subMap value
="CWOS94" resultMap= "Legislation.CWOS94"/>
< subMap value="EL05NM"
resultMap="Legislation.EL05NM"/>
. about 20 more subMaps ..
discriminator> resultMap
>
< sql id="legDiscriminatorTestSQL"
>
SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID,
leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS
LEGISLATION_VERSION_ID
FROM EM_TENEMENT_LEGISLATION_TB leg
WHERE leg.LEGISLATION_ID = #value# sql>
< resultMap id="oneToOneTestRM" class="emits.domain.tenement.DisplayTenement" >
<result property
="id" column= "TENEMENT_ID"/>
<result property="legislation" resultMap="Legislation.tenementLegislationRM" /> resultMap>
<select id="legDiscriminatorTestFails"
resultMap="oneToOneTestRM" >
<include refid
="legDiscriminatorTestSQL"/> select>
<select id ="legDiscriminatorTestWorks" resultMap= "Legislation.tenementLegislationRM" >
<include refid=
"legDiscriminatorTestSQL"/>
select>
"DISCLAIMER: This email,
including any attachments, is intended only for use by the
addressee(s) and may contain confidential and/or personal information
and may also be the subject of legal privilege. If you are not the
intended recipient, you must not disclose or use the information
contained in it. In this case, please let me know by return email,
delete the message permanently from your system and destroy any
copies. Before you take any action based upon advice and/or
information contained in this email you should carefully consider the
advice and information and consider obtaining relevant independent
advice.
No problem, I'll provide the
unit test.
From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 2 August 2006 11:09 AMTo:
user-java@ibatis.apache.orgSubject: Re: JIRA 225 and discriminator
tag.
I'll take a look at this. If you can provide a reproducable test
case, it would be good to add the test case to the JIRA ticket.
Jeff Butler
On 8/1/06, MCCORMICK,
Paul <[EMAIL PROTECTED]>
wrote:
Hi, I've downloaded the latest ibatis code from SVN last week as I needed
the following feature: http://issues.apache.org/jira/browse/IBATIS-225
I have encountered a problem. The
reused result map ignores the discriminator tag. I've attached
some code below. The legDiscriminatorTestFails query fails. The
query should return a DisplayTenement object containing a single Legislation
object. The query legDiscriminatorTestWorks works. This
returns a single Legislation object. Both queries use the same args and return
the same db results. In the query that fails the discriminator tag
does not find a match for any sub Maps so it defaults to using the Legislation
class which is abstract. Am I doing something wrong?
Here are the
classes: public class
DisplayTenement { private Integer id; private Legislation
legislation; }
public abstract class
Legislation { private Integer tenementId;
}
public class
SpecialProspectingLegislation82 extends Legislation {
}
<resultMap id ="tenementLegislationRM" class= "Legislation" >
<result property="id" column="LEGISLATION_ID"/> <result property
="tenementId"
column= "TENEMENT_ID"/>
<result property="effectiveRange" column="START_STMP"/> <result property
="versionId" column=
"LEGISLATION_VERSION_ID"/> < discriminator column="LEGISLATION_CODE" javaType="java.lang.String" >
<subMap value
="AMLS60" resultMap= "Legislation.AMLS60"/>
<
subMap value="CWOS80" resultMap="Legislation.CWOS80"/>
<subMap value
="CWOS94" resultMap= "Legislation.CWOS94"/>
<
subMap value="EL05NM" resultMap="Legislation.EL05NM"/>
. about 20 more subMaps ..
discriminator> resultMap
>
<
sql id="legDiscriminatorTestSQL" >
SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID,
leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS
LEGISLATION_VERSION_ID
FROM EM_TENEMENT_LEGISLATION_TB leg
WHERE leg.LEGISLATION_ID = #value# sql>
<
resultMap id="oneToOneTestRM" class="emits.domain.tenement.DisplayTenement" >
<result property
="id" column=
"TENEMENT_ID"/>
<result property="legislation" resultMap="Legislation.tenementLegislationRM" /> resultMap>
<select id="legDiscriminatorTestFails"
resultMap="oneToOneTestRM" >
<include refid
="legDiscriminatorTestSQL"/> select>
<select id
="legDiscriminatorTestWorks" resultMap= "Legislation.tenementLegislationRM" >
<include refid= "legDiscriminatorTestSQL"/> select>
"DISCLAIMER: This email,
including any attachments, is intended only for use by the addressee(s)
and may contain confidential and/or personal information and may also be
the subject of legal privilege. If you are not the intended recipient,
you must not disclose or use the information contained in it. In this
case, please let me know by return email, delete the message permanently
from your system and destroy any copies. Before you take any
action based upon advice and/or information contained in this email you
should carefully consider the advice and information and consider
obtaining relevant independent
advice.
Title: JIRA 225 and discriminator tag.
Hi,
I've downloaded the latest ibatis code from SVN last week as I needed the following feature: http://issues.apache.org/jira/browse/IBATIS-225
I have encountered a problem. The reused result map ignores the discriminator tag. I've attached some code below. The legDiscriminatorTestFails query fails. The query should return a DisplayTenement object containing a single Legislation object. The query legDiscriminatorTestWorks works. This returns a single Legislation object. Both queries use the same args and return the same db results. In the query that fails the discriminator tag does not find a match for any sub Maps so it defaults to using the Legislation class which is abstract. Am I doing something wrong?
Here are the classes:
public class DisplayTenement {
private Integer id;
private Legislation legislation;
}
public abstract class Legislation {
private Integer tenementId;
}
public class SpecialProspectingLegislation82 extends Legislation {
}
. about 20 more subMaps ..
discriminator>
resultMap>
SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID, leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS LEGISLATION_VERSION_ID
FROM EM_TENEMENT_LEGISLATION_TB leg
WHERE leg.LEGISLATION_ID = #value#
sql>
resultMap>
The proxy requires web auth. I tried adding the
proxy details to TortoiseSVN but that did not work. The proxy uses NTLN
authentication which is something that tortoise does not
understand.
I'll download it from home.
Thanks,
Paul
From: Clinton Begin
[mailto:[EMAIL PROTECTED] Sent: Tuesday, 25 July 2006 11:55
AMTo: user-java@ibatis.apache.orgSubject: Re: SVN
Repository
Don't you have an HTTP proxy? Or does it require web
auth?
On 7/24/06, MCCORMICK,
Paul <
[EMAIL PROTECTED]> wrote:
Thanks. I was hoping a firefox extension or something browser
based. None of the free SVN clients I've tried support NTLM
authentication which is needed to get past the corp
firewall.
From: Jeff Butler [mailto:[EMAIL PROTECTED] ]
Sent: Tuesday, 25 July 2006 11:22 AMTo: user-java@ibatis.apache.orgSubject: Re: SVN
Repository
You need to use an SVN client. I like this:
http://tortoisesvn.tigris.org/
Once you install the SVN client, then you can do an SVN checkout which
will download the latest source. Then run the build command in the
/build subdirectory.
I think the source is fairly stable - all the tests pass.
Jeff Butler
On 7/24/06, MCCORMICK,
Paul <[EMAIL PROTECTED]> wrote:
Hi,
There are some improvements since the
2.1.7 release that I would like to use. How can I download the
latest source code. I've tried mapping a web folder to http://svn.apache.org/repos/asf/ibatis/trunk/ but I am prompted for a password.
Any idea on how stable is the latest
code and is?
Cheers, Paul
"DISCLAIMER: This email,
including any attachments, is intended only for use by the
addressee(s) and may contain confidential and/or personal information
and may also be the subject of legal privilege. If you are not the
intended recipient, you must not disclose or use the information
contained in it. In this case, please let me know by return email,
delete the message permanently from your system and destroy any
copies. Before you take any action based upon advice and/or
information contained in this email you should carefully consider the
advice and information and consider obtaining relevant independent
advice.
Thanks. I was hoping a firefox
extension or something browser based. None of the free SVN
clients I've tried support NTLM authentication which is needed to get
past the corp firewall.
From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 25 July 2006 11:22 AMTo:
user-java@ibatis.apache.orgSubject: Re: SVN
Repository
You need to use an SVN client. I like this:
http://tortoisesvn.tigris.org/
Once you install the SVN client, then you can do an SVN checkout which will
download the latest source. Then run the build command in the /build
subdirectory.
I think the source is fairly stable - all the tests pass.
Jeff Butler
On 7/24/06, MCCORMICK,
Paul <[EMAIL PROTECTED]>
wrote:
Hi,
There are some improvements since the
2.1.7 release that I would like to use. How can I download the
latest source code. I've tried mapping a web folder to http://svn.apache.org/repos/asf/ibatis/trunk/ but I am prompted for a password.
Any idea on how stable is the latest code
and is?
Cheers, Paul
"DISCLAIMER: This email,
including any attachments, is intended only for use by the addressee(s)
and may contain confidential and/or personal information and may also be
the subject of legal privilege. If you are not the intended recipient,
you must not disclose or use the information contained in it. In this
case, please let me know by return email, delete the message permanently
from your system and destroy any copies. Before you take any
action based upon advice and/or information contained in this email you
should carefully consider the advice and information and consider
obtaining relevant independent
advice.
Title: SVN Repository
Hi,
There are some improvements since the 2.1.7 release that I would like to use. How can I download the latest source code. I've tried mapping a web folder to http://svn.apache.org/repos/asf/ibatis/trunk/ but I am prompted for a password.
Any idea on how stable is the latest code and is?
Cheers,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Hi Chaithanya,
Is you second name really
ibatis?
From: chaithanya ibatis
[mailto:[EMAIL PROTECTED] Sent: Friday, 14 July 2006 2:29
PMTo: user-java@ibatis.apache.orgSubject: URGENT :::
Caused by: java.lang.NoSuchMethodError:
oracle.sql.STRUCT.toClass(Ljava/lang/Class;Ljava/util/Map;)Ljava/lang/Object;
Hi,I'm getting this error:using userdefined type in
procedure. in that type, the datatypes are number(12,2), varchar2,
number. In the dto ,i declared BigDecimal for number(12,2),when i read
using readBigDecimal . will this creates this problem or any thing else. pls
give me solution. i have used these classes. DTO, DTOTYPESQLDATA
for userdefined typejava.rmi.ServerError: Unexpected Error; nested
exception is: java.lang.NoSuchMethodError:
oracle.sql.STRUCT.toClass(Ljava/lang/Class;Ljava/util/Map;)Ljava/lang/Object;
at
org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:399)
at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:196)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke
(ProxyFactoryFinderInterceptor.java:122) at
org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873) 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:324) at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke
(Invocation.java:72) at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke
(JRMPInvoker.java:805) at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
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:324) at
sun.rmi.server.UnicastServerRef.dispatch
(UnicastServerRef.java:261) at
sun.rmi.transport.Transport$1.run(Transport.java:148) at
java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java
:144) at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java :534)Caused by:
java.lang.NoSuchMethodError:
oracle.sql.STRUCT.toClass(Ljava/lang/Class;Ljava/util/Map;)Ljava/lang/Object;
at
uk.co.lvl.ecommerce.orderprocessing.OrderProcessingDAO.getFinancialDetail(OrderProcessingDAO.java
:148) at
uk.co.lvl.ecommerce.orderprocessing.OrderProcessingImpl.getFinancialDetail(OrderProcessingImpl.java:107)
at
uk.co.lvl.ecommerce.orderprocessing.OrderProcessingBean.getFinancialDetail(OrderProcessingBean.java
:232) 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:324) at
org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke
(StatelessSessionContainer.java:214) at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke
(StatelessSessionInstanceInterceptor.java:154) at
org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
at
org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java
:48) at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:300)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
(TxInterceptorCMT.java:166) at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
... 25 moreRegards,Chaithanya
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the
Title: How can I reuse a resultMap.
That issues is resolved in latest
version: http://issues.apache.org/jira/browse/IBATIS-225
From: MCCORMICK, Paul
[mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 July 2006
3:02 PMTo: user-java@ibatis.apache.orgSubject: How can I
reuse a resultMap.
I have a resultMap I use to populate a Name
object. Here is the class and result map.
public class Name { public Integer name_id }
public class CompanyName extends Name {
// has
may properties }
public class PersonName extends Name {
// has
may properties }
How can I use the above resultMap
definition when the Name class is a property of an object. The Customer
class has a Name as a property.
public class Customer {
private
Integer customerId;
private Name name; }
select CUSTOMER_ID, NAME_ID, NAME_TYPE,
I can get it to work is I add a List
property to the Customer class and use that instead of the Name property..
E.g
public class Customer {
private
Integer customerId; // private Name name;
private List nameList;
public
Name getName() {
return
(Name)getNameList().get(0);
} }
I don't want to complicate the bean by
adding getters and setters that are only used by Ibatis. Is there another
way to do this?
Thanks, Paul
"DISCLAIMER: This email, including
any attachments, is intended only for use by the addressee(s) and may
contain confidential and/or personal information and may also be the
subject of legal privilege. If you are not the intended recipient, you
must not disclose or use the information contained in it. In this case,
please let me know by return email, delete the message permanently from
your system and destroy any copies. Before you take any action
based upon advice and/or information contained in this email you should
carefully consider the advice and information and consider obtaining
relevant independent advice.
Title: How can I reuse a resultMap.
I have a resultMap I use to populate a Name object. Here is the class and result map.
public class Name {
public Integer name_id
}
public class CompanyName extends Name {
// has may properties
}
public class PersonName extends Name {
// has may properties
}
How can I use the above resultMap definition when the Name class is a property of an object. The Customer class has a Name as a property.
public class Customer {
private Integer customerId;
private Name name;
}
NameRM"/>
select CUSTOMER_ID, NAME_ID, NAME_TYPE,
I can get it to work is I add a List property to the Customer class and use that instead of the Name property.. E.g
public class Customer {
private Integer customerId;
// private Name name;
private List nameList;
public Name getName() {
return (Name)getNameList().get(0);
}
}
I don't want to complicate the bean by adding getters and setters that are only used by Ibatis. Is there another way to do this?
Thanks,
Paul
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
>>Thanks Jeff for your comments. Makes perfect sense. I forgot about
using a custom List Implementation approach. >>That would work out
nicely.
How would you inject your custom list implementation? Is thought ibatis
created the list implementation and did not provide the ability to
override it.
For example, if the Person was defined like below would ibatis create a
MyListImp object instead of its own List implementation?
Person Object
-
MyListImp cats;
MyListImp dogs;
int personID;
String personName;
-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Friday, 12 May 2006 8:17 AM
To: user-java@ibatis.apache.org
Subject: Re: One query populating *multiple* lists per object returned
Jeff Butler wrote:
> It's not really a stupid question. The problem is that adding the Dog
> table to the join list will, in effect, create a cross join between
> dog and cat - causing lots of data to be repeated as you've seen.
>
> There's not a great solution that I can think of. One solution would
> be to use the iBATIS group by solution and a join for one of the lists
> (cats) - as you've already accomplished. For the other list (dogs),
> you can populate it with a second query sort of like this:
>
>
>
>
>
>
>
>
> I haven't tried this for real, but I think it will work. This is
> still an N+1 query, but at least it's not 2N+1!
>
> Another thought is that you could write your own List implementation
> that would not allow duplicates. Then it could all be done in one
> query because you would catch and throw out the duplicates in Java
> code. As I think about it, I might like this solution better.
> There's still a bunch of duplicate data coming back from the DB, but
> there's only on DB call.
Thanks Jeff for your comments. Makes perfect sense. I forgot about using
a custom List Implementation approach. That would work out nicely.
--
Rick
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.
Title: Capability to use dynamic sql within iterates
I did some further testing after reading issue 131 http://issues.apache.org/jira/browse/IBATIS-131
I found that and
tags work in this situation but other tags like do not
work. Has anybody got the tag to work in the sistuation
below?
Thanks,
Paul
From: MCCORMICK, Paul
[mailto:[EMAIL PROTECTED] Sent: Friday, 5 May 2006 11:23
AMTo: user-java@ibatis.apache.orgSubject: Capability to
use dynamic sql within iterates
Hello I have read
Issue 148 and it looks like I can use dynamic sql within an iterate tag
http://issues.apache.org/jira/browse/IBATIS-148
I have a problem when I set the
property on a
tag to be a value on the iterated object. See "myListOfGooObjects[].id" the below
sql.
<select id="testIterate" resultClass="java.util.HashMap" parameterClass="Foo">
select *
from foo
WHERE
<iterate property="myListOfGooObjects" conjunction="AND" >
EXISTS ( SELECT 1
FROM bla
WHERE bla.type =
'X'
<isNotNull property="myListOfGooObjects[].id">
and ( id =
#myListOfGooObjects[].id# )
isNotNull>
)
iterate>
select>
Here is the parameter classes used, getters and
setters ommited. class Foo { // Contains a list of Goo objects
List myListOfGooObjects;
}
class Goo { // This is the value that is want to the
tag on.
Integer id; }
The error is get is: ---
Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal list from
JavaBean. Cause java.lang.NumberFormatException: For input string: ""Caused
by: java.lang.NumberFormatException: For input string: ""
"DISCLAIMER: This email, including
any attachments, is intended only for use by the addressee(s) and may
contain confidential and/or personal information and may also be the
subject of legal privilege. If you are not the intended recipient, you
must not disclose or use the information contained in it. In this case,
please let me know by return email, delete the message permanently from
your system and destroy any copies. Before you take any action
based upon advice and/or information contained in this email you should
carefully consider the advice and information and consider obtaining
relevant independent advice.
Title: Capability to use dynamic sql within iterates
Hello
I have read Issue 148 and it looks like I can use dynamic sql within an iterate tag
http://issues.apache.org/jira/browse/IBATIS-148
I have a problem when I set the property on a tag to be a value on the iterated object. See "myListOfGooObjects[].id" the below sql.
select *
from foo
WHERE
EXISTS ( SELECT 1
FROM bla
WHERE bla.type = 'X'
and ( id = #myListOfGooObjects[].id# )
isNotNull>
)
iterate>
select>
Here is the parameter classes used, getters and setters ommited.
class Foo {
// Contains a list of Goo objects
List myListOfGooObjects;
}
class Goo {
// This is the value that is want to the tag on.
Integer id;
}
The error is get is:
--- Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean. Cause java.lang.NumberFormatException: For input string: ""
Caused by: java.lang.NumberFormatException: For input string: ""
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Title: Two quick questions..
I'll add to those questions
1) Be careful when updating cached data in a transactional
environment. If you update a cached object, then calling a rollback will
undo db changes but not changes to the object in memory. You should clone
cached object before updating in this case.
2) If you set ibatis to flush the cache on a update it will
not work correctly in a clustered environment. Only one instance in the
cluster would have its cached flushed.
From: Lingala, Sadasiva
[mailto:[EMAIL PROTECTED] Sent: Thursday, 20 April 2006 7:23
AMTo: user-java@ibatis.apache.orgSubject: Two quick
questions..
1. Can I selectively use lazy loading for some
results but not others? How do I specify this? I only see one global setting in
sqlMapConfig.xml.
2. How does iBatis caching know that data/object to
be retrieved is already in cache? Does it use SQL statement as key or some
thing? Does Bean need to implement any methods to support caching?
Thanks
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Title: Message
You can't get access to the column name. I've
tried before. Its a private field on the
ResultGetter implementation object. If only there was a getter method
on the ResultGetter interface. Now that's an
idea...
Paul
From: Balaji [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 29 March 2006 12:30 AMTo:
user-java@ibatis.apache.orgSubject: Re: CTH - column
name
won't getColumnName(int) need the column
index. What column index?
Tried doing getter.getClob().getAsciiStream();
- does not work bcos of Jconnect /Jdbc driver does not support getClob()
method.
I am reading a 'text' column by calling getter.getResultSet().getAsciiStream("COLNAME");
But, i do not want to hard code the column name and
be able to use CTH it for multiple columns of similar data type
Balaji
- Original Message -
From:
Lingala, Sadasiva
To: user-java@ibatis.apache.org
Sent: Tuesday, March 28, 2006 10:13
AM
Subject: RE: CTH - column name
I
think you can get column name from jdbc resultset metadata. Metadata
can be accessed from resultset
-Original Message-From: Balaji
[mailto:[EMAIL PROTECTED] Sent: Tuesday, March 28, 2006 11:09
AMTo: user-java@ibatis.apache.orgSubject:
CTH - column name
Is there way to determine the column name
that is being processed in getresult method (ResultGetter) of column
type handler code?
Balaji
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Instead of using a timestamp I use an integer and increment
the value on every update.
update customer
set NAME= #name#,
VERSION_ID = VERSION_ID +
1
where ID = #ID# and VERSION_ID =
#VERSION_ID#
Then in the Dao I would increment versionId value on the
CustomerDTO object if the update succeeded.
int rowCount =
getSqlMapClientTemplate().update( "Customer-update", record); if(rowCount == 0)
{
throw new OptimisticLockingFailureException("Optimistic Lock
Failure! Unable to update record: " + record);
}
record.setVersionId(record.getVersionId() + 1
);
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Sent: Wednesday, 15 March
2006 11:55 PMTo: user-java@ibatis.apache.orgSubject:
Optimistic locking question
I have a table: CREATE TABLE CUSTOMER ID NUMBER NOT NULL, NAME VARCHAR(32) NOT
NULL,
RECORD_DATE TIMESTAMP NOT NULL,
... The
Record_Date is used to determine the last time the record was updated, so when I
perform an update my SQL would look something like: update customer set name = #name#, record_date = getDate(),
... where id = #id# and
record_date = #recordDate#
This allows me to do the following in my
Dao:
int rowCount = getSqlMapClientTemplate().update( "Customer-update",
record);
if(rowCount == 0) { throw new
OptimisticLockingFailureException("Optimistic Lock Failure! Unable to update
record: " + record); } return rowCount;
The
problem that I have is if my SQL is performing the update of the record_date
field when the insert is performed, how do I update my domain object with the
new value without performing a read from the table? Thanks for the help... Chris Mathrusse[EMAIL PROTECTED]Sybase,
IncOne Sybase DriveDublin, CA 94568(925) 236-5553
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
Title: Nested iterate tag
Is it possible to nest iterate tags so I can traverse a list of lists?
For example:
#A[].B[].field#
iterate>
iterate>
Thanks,
Paul McCormick
IT Consultant
DEPARTMENT OF INDUSTRY AND RESOURCES
100 Plain Street, East Perth, Western Australia 6004
Telephone: +61 8 9222-3481, Mobile:0422958958
www.doir.wa.gov.au
"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice.
I've got a similar problem. I have a immutable Quantity object that takes two
arguments for its constructor. No of the Quantity properties can be populated
using setter methods. I would like to use a custom type handler to construct
the object. Doing reflection on the result set will not always work because as
there can be more that one Quantity objects per row.
Here is my idea how ibatis could be changed for this to work.
1) Allow multiple column names to be in the 'column' attribute of the result
tag. See below.
.
2) Add a method to give the TypeHandlerCallback access to the names of the
column.
e.g.
public interface TypeHandlerCallback {
public String[] getColumnNames();
}
This would allow reflection on the result set using the column names. I'm sure
there are more elegant ways to do this where ibatis would do the reflection.
I guess I can expect someone to implement this in the next few days :)
Paul
-Original Message-
From: Ron Turner [mailto:[EMAIL PROTECTED]
Sent: Friday, 08 July 2005 4:28 AM
To: user-java@ibatis.apache.org
Subject: ResultSet metadata
Hi All,
I'm writing a custom type handler and want to get access to the meta data for
the column in context at the time the handler is invoked. I know that I can get
access to the complete result set using getter.getResultSet(), but how do I
identify the particular column in which I'm interested? There doesn't appear
to be a way to obtain the column's name from the ResultGetter and I'm reluctant
to use reflection to obtain this information... Any thoughts?
Thanks!
"DISCLAIMER: This email, including any attachments, is intended only for use by
the addressee(s) and may contain confidential and/or personal information and
may also be the subject of legal privilege. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.
Before you take any action based upon advice and/or information contained in
this email you should carefully consider the advice and information and
consider obtaining relevant independent advice.