Re: Re : Re : Re : Re : Log4j again... sorry

2007-09-04 Thread Rusty Wright
I don't know if this is what is affecting you but I find the log4j 
properties file format confusing and error prone so I use the xml 
format.  Here is my log4j.xml file:




http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd";>

http://jakarta.apache.org/log4j/";>
   
   
   

   

   

   
   
   
   

   
   
   
   
   

   
   
   
   
   
   

   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   
   

   
   

   
   

   

   
   



And in my web.xml I have

   
   
   log4jConfigLocation
   

   
   /WEB-INF/log4j.xml
   
   

   
   
   org.springframework.web.util.Log4jConfigListener
   
   


Gilles Schlienger wrote:

Thanks Jeff
Gilles

- Message d'origine 
De : Jeff Butler <[EMAIL PROTECTED]>
À : user-java@ibatis.apache.org
Envoyé le : Vendredi, 31 Août 2007, 17h41mn 19s
Objet : Re: Re : Re : Re : Log4j again... sorry

iBATIS logs almost everything to java.sql logs.  The only thing you'll 
see in com.ibatis is caching information.  Sounds like you've got it 
working.
 
Jeff Butler



 
On 8/31/07, *Gilles Schlienger* <[EMAIL PROTECTED] 
> wrote:


Tried that but still no luck.

java.sql logs work fine though

But still nothing with com.ibatis.etc...

Don't know what to try...

Regards
Gilles

- Message d'origine 
De : Brandon Goodin < [EMAIL PROTECTED]
>
À : user-java@ibatis.apache.org 
Envoyé le : Vendredi, 31 Août 2007, 16h29mn 44s
Objet : Re: Re : Re : Log4j again... sorry


Additionally you could try adding commons-logging to your webapp
classpath and then place the following contents into a
WEB-INF/commons-logging.properties file:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger


Brandon

On 8/31/07, *Brandon Goodin* < [EMAIL PROTECTED]
> wrote:

Make sure you have log4j in your webapp classpath and then add
the following to your log4j.properties file in the root of
your WEB-INF/classes directory.

# Rules reminder:
# DEBUG < INFO < WARN < ERROR < FATAL

# Global logging configuration
log4j.rootLogger=WARN, stdout

# SqlMap logging configuration...
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG

log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG

log4j.logger.com.auxilium.web=DEBUG

## Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p %d %C.%M():
%m%n

Brandon


On 8/31/07, *Gilles Schlienger* < [EMAIL PROTECTED]
> wrote:

Something weird:
I created a servlet listener, and added it in my web.xml file.

In this listener I call:
com.ibatis.common.logging.LogFactory.selectLog4JLogging();

Still I get no log in the console or anywhere else...
I use Ibatis with Spring using Spring's Template.

Regards
Gilles

- Message d'origine 
De : Gilles Schlienger <[EMAIL PROTECTED]
 >
À : user-java@ibatis.apache.org

Envoyé le : Vendredi, 31 Août 2007, 16h10mn 12s
Objet : Re : Log4j again... sorry

Thanks for your email,

Still no luck though...
No log happens.
But I can see the SQL request in my MYSQL database logs...

Regards
Gilles

- Message d'origine 
De : Larry Meadors <[EMAIL PROTECTED]
 >
À : user-java@ibatis.apache.org

Envoyé le : Vendredi, 31 Août 2007, 15h09mn 37s
Objet : Re: Log4j again... sorry

Try this:

log4j.logger.java.sql=DEBUG

Larry


On 8/31/07, Gilles Schl

iBatis Select Query

2007-09-04 Thread prvijay

Hi,

   i a m using iBatis for executing a select query, it works fine if the
query has a return value. Its giving null when the query does not have any
results. Thats notthe case with procedure. Do anyone have any idea on this.
-- 
View this message in context: 
http://www.nabble.com/iBatis-Select-Query-tf4376563.html#a12474812
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.



Re: JavaBean and Map parameters

2007-09-04 Thread Ilya Boyandin


Thank you, now everything is clear :)

Best regards
Ilya

Larry Meadors wrote:

Heh, I think I wrote that part. :-)

You can't reliably refer to an *anonymous* inner class by name (hence
the anonymous part - IIRC, they are assigned names by location
MyClass$1, MyClass$2, etc), so you can't safely put the name in your
mapped statement, so iBATIS doesn't do that load time checking
(because it doesn't know the parameter class name).

For load time checking to work, the parameter class name has to be
associated with the mapped statement (either as an explicit parameter
map, or a parameterClass attribute).

Larry


On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:
  

Hi Larry,

Larry Meadors wrote:


I don't know about the performance - a hashmap is pretty fast for
retrieval. (FYI: the constructor you use there will cause slower
performance - the default would use more memory, but be faster - using
3 or 4 as the parameter might be better, read the javadocs on that
one.)

  

Oh sure, I forgot about the .75 load factor. Thanks for telling me this!
I agree in this case it's better not to use the parameter at all.



The parameter checking is an interesting idea - I'm just not sure that
it makes it much less error prone - in both cases, you need to type
(or paste) the names.

  

It's not my idea, actually. I found it in the section "JavaBean and Map
parameters" of "iBatis in Action". It sais:
"If you create a parameter map with a bean and attempt to refer to a
property that does not exist, you will get an immediate failure when the
parameter map is loaded." I tested it now with the anonymous parameter
class I cited before and it doesn't seem to work as described:  the
"There is no READABLE property named" exception is thrown only when the
query is called, not when the map is loaded. I think I got something
wrong again :)

Regards
Ilya




On 9/3/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:

  

Thanks, Larry!

but could you tell me why? I thought using an anonymous class has an
important advantage: it allows loading-time parameter check. Also I
think it should be faster than using HashMap. Isn't it true?

Ilya

Larry Meadors wrote:



Well, they should both do the same thing...I'd use the map. :)

Larry


On 8/31/07, Ilya Boyandin <[EMAIL PROTECTED]> wrote:


  

Hello all,

what should I prefer, this:

return getSqlMapClientTemplate().queryForList("listEvaluationPlans", new
Object() {
long getPersonId() { return personId; }
String getLang() { return lang; }
});

or this:

final Map params = new HashMap(2);
params.put("personId", personId);
params.put("lang", lang);
return getSqlMapClientTemplate().queryForList("listEvaluationPlans",
params);

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


Re: Using discriminator with an interface

2007-09-04 Thread Ilya Boyandin


Thanks Paul,

I think though it's not a quite straightforward solution it must work 
for me.


Regards
Ilya

MCCORMICK, Paul wrote:

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


Re: PaginatedList

2007-09-04 Thread John Chien

Brandon:

Thank you for the response.
Should be all four parameters be included in the   ?
If yes, how ?

resultClass="resulyObjectClass">

  SELECT  STATEMENT


Brandon Goodin wrote:
There is no replacement needed. The SqlMap contains a method called 
queryForList(String id, Object parameter, int skip, int max). See the 
javadoc below. This will accomplish what you want. We've decided that 
the PaginatedList is outside the scope of iBATIS and oft abused. That 
is why we deprecated it.



  queryForList

public 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.).
|skip| - The number of results to ignore.
|max| - The maximum number of results to return. 
*Returns:*
A List of result objects. 
*Throws:*

|java.sql.SQLException| - If an error occurs.


  queryForList

public java.util.List *queryForList*(java.lang.String id,
   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.

This overload assumes no parameter is needed.

*Parameters:*
|id| - The name of the statement to execute.
|skip| - The number of results to ignore.
|max| - The maximum number of results to return. 
*Returns:*
A List of result objects. 
*Throws:*

|java.sql.SQLException| - If an error occurs.

Cheers,
Brandon

On 8/31/07, *John Chien* <[EMAIL PROTECTED] 
> wrote:



Dear Sir:

I heard that paginated list will be removed from IBatis. Is it true ?
If that is true, what is the replacement ?

Thanks,

John Chien


begin:vcard
fn:John Chien
n:Chien;John
email;internet:[EMAIL PROTECTED]
tel;work:919-715-2510
version:2.1
end:vcard



Re: PaginatedList

2007-09-04 Thread Brandon Goodin
Hey John,

skip and max do not need to be passed to your . These values are
used when iBATIS is traversing the resultset that is returned from the
database. For example, you query the database and it has 300 potential
records returned in the resultset. If skip is set to 50 and max is set to
100, iBATIS will begin at record 50 and map the next 100 records into your
resultClass/resultMap defined objects.

Brandon

On 9/4/07, John Chien <[EMAIL PROTECTED]> wrote:
>
>  Brandon:
>
> Thank you for the response.
> Should be all four parameters be included in the   ?
> If yes, how ?
>
>  resultClass="resulyObjectClass">
>SELECT  STATEMENT
> 
>
> Brandon Goodin wrote:
>
> There is no replacement needed. The SqlMap contains a method called
> queryForList(String id, Object parameter, int skip, int max). See the
> javadoc below. This will accomplish what you want. We've decided that the
> PaginatedList is outside the scope of iBATIS and oft abused. That is why we
> deprecated it.
>
> queryForList
>
> public 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.). skip - The number of results to ignore. max- 
> The maximum number of results to return.
> *Returns:* A List of result objects. *Throws:* java.sql.SQLException - If
> an error occurs.  queryForList
>
> public java.util.List *queryForList*(java.lang.String id,
>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.
>
> This overload assumes no parameter is needed.
>
>   *Parameters:* id - The name of the statement to execute. skip - The
> number of results to ignore. max - The maximum number of results to
> return. *Returns:* A List of result objects. *Throws:*
> java.sql.SQLException - If an error occurs.  Cheers,
> Brandon
>
> On 8/31/07, *John Chien* <[EMAIL PROTECTED]> wrote:
>
>
> Dear Sir:
>
> I heard that paginated list will be removed from IBatis. Is it true ?
> If that is true, what is the replacement ?
>
> Thanks,
>
> John Chien
>
>
>
>


Lazy Loading losing field value

2007-09-04 Thread Christopher . Mathrusse

I'm using iBatis 2.3.0 build# 677 with
JDK 1.5.11

I have the following 3 tables.

create
table
op_rule_drl (
   id      
            numeric(18)
                   identity,
   name      
          varchar(32)
                   not
null,
   content    
         text          
                null,
   create_date    
     datetime            
          default
getdate() not
null,
   mod_date    
        datetime          
            default
getdate() not
null,
   version    
         int
                     
     default
0 not
null
)
lock datarows
with
identity_gap = 10
go

create
table
op_rule_dsl (
   id      
            numeric(18)
                   identity,
   name      
          varchar(32)
                   not
null,
   content    
         text          
                null,
   create_date    
     datetime            
          default
getdate() not
null,
   mod_date    
        datetime          
            default
getdate() not
null,
   version    
         int
                     
     default
0 not
null
)
lock datarows
with
identity_gap = 10
go

create
table
op_rule_set (
   id      
            varchar(32)
                   not
null,
   drl_id      
        numeric(18)
                   not
null,
   dsl_id      
        numeric(18)
                   not
null,
   description    
     varchar(200)
                  null,
   create_date    
     datetime            
          default
getdate() not
null,
   mod_date    
        datetime          
            default
getdate() not
null,
   version    
         int
                     
     default
0 not
null
)
lock datarows
with
identity_gap = 10
go


I have corresponding Domain & Doa
objects. Everything works well when I perform operations on the RuleDSL
and RuleDRL. (select, insert, update, delete) 

The problem is when I lazy load these
objects from my RuleSet SQLMap. The objects get loaded except one field.
As detailed above, the version field is for optimistic locking. When I
load them lazily from the RuleSet object all values are returned correctly
but the version field is null in both the RuleDSL and RuleDRL objects.
This of course prevents me from performing any update or delete operations
on the objects. I don't understand why this should be occurring as I have
verified the operations in both the RuleDRL and RuleDSL maps work correctly.
When I perform a findByPrimaryKey in both of these SQL Maps all values
are returned as expected. Only when these objects are loaded lazily do
I see this issue. I've attached the SQL maps incase I have overlooked something.

Thanks for the help...



Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553

RuleSet.xml
Description: Binary data


RuleDRL.xml
Description: Binary data


RuleDSL.xml
Description: Binary data


Abator - Generated beans extend a base model?

2007-09-04 Thread maomaode

Hi,

I ready have a base model, and is it possible to generate the java beans 
and those beans extend the base model?


Let say i have a blog.post table, and abator will generate a Post bean, 
but most of the attributes in the Post, already exist in Entry class


So, I'm wondering, if it's possible to customize the generated Post 
bean, and generate a bean like this


public class Post extends Entry {
...
}

Thanks in advance,
James


Re: Abator - Generated beans extend a base model?

2007-09-04 Thread Ashok Madhavan
you can use the rootClass attribute.





it will do the "public class Post extends Entry ..." stuff. but it will also
override all the methods even if those exist in the parent class.

regards
Ashok
On 9/5/07, maomaode <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I ready have a base model, and is it possible to generate the java beans
> and those beans extend the base model?
>
> Let say i have a blog.post table, and abator will generate a Post bean,
> but most of the attributes in the Post, already exist in Entry class
>
> So, I'm wondering, if it's possible to customize the generated Post
> bean, and generate a bean like this
>
> public class Post extends Entry {
> ...
> }
>
> Thanks in advance,
> James
>


Re: Re : Re : Re : Re : Log4j again... sorry

2007-09-04 Thread Rusty Wright
 I don't know if this is what is affecting you but I find the log4j 
properties file format confusing and error prone so I use the xml 
format.  Here is my log4j.xml file:




http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd";>

http://jakarta.apache.org/log4j/";>
   
   
   

   

   

   
   
   
   

   
   
   
   
   

   
   
   
   
   
   

   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   

   
   
   
   
   
   

   
   

   
   

   

   
   



And in my web.xml I have

   
   
   log4jConfigLocation
   

   
   /WEB-INF/log4j.xml
   
   

   
   
   org.springframework.web.util.Log4jConfigListener
   
   


Gilles Schlienger wrote:

Thanks Jeff
Gilles

- Message d'origine 
De : Jeff Butler <[EMAIL PROTECTED]>
À : user-java@ibatis.apache.org
Envoyé le : Vendredi, 31 Août 2007, 17h41mn 19s
Objet : Re: Re : Re : Re : Log4j again... sorry

iBATIS logs almost everything to java.sql logs.  The only thing you'll 
see in com.ibatis is caching information.  Sounds like you've got it 
working.
 
Jeff Butler



 
On 8/31/07, *Gilles Schlienger* <[EMAIL PROTECTED] 
> wrote:


Tried that but still no luck.

java.sql logs work fine though

But still nothing with com.ibatis.etc...

Don't know what to try...

Regards
Gilles

- Message d'origine 
De : Brandon Goodin < [EMAIL PROTECTED]
>
À : user-java@ibatis.apache.org 
Envoyé le : Vendredi, 31 Août 2007, 16h29mn 44s
Objet : Re: Re : Re : Log4j again... sorry


Additionally you could try adding commons-logging to your webapp
classpath and then place the following contents into a
WEB-INF/commons-logging.properties file:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger


Brandon

On 8/31/07, *Brandon Goodin* < [EMAIL PROTECTED]
> wrote:

Make sure you have log4j in your webapp classpath and then add
the following to your log4j.properties file in the root of
your WEB-INF/classes directory.

# Rules reminder:
# DEBUG < INFO < WARN < ERROR < FATAL

# Global logging configuration
log4j.rootLogger=WARN, stdout

# SqlMap logging configuration...
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG

log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG

log4j.logger.com.auxilium.web=DEBUG

## Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p %d %C.%M():
%m%n

Brandon


On 8/31/07, *Gilles Schlienger* < [EMAIL PROTECTED]
> wrote:

Something weird:
I created a servlet listener, and added it in my web.xml file.

In this listener I call:
com.ibatis.common.logging.LogFactory.selectLog4JLogging();

Still I get no log in the console or anywhere else...
I use Ibatis with Spring using Spring's Template.

Regards
Gilles

- Message d'origine 
De : Gilles Schlienger <[EMAIL PROTECTED]
 >
À : user-java@ibatis.apache.org

Envoyé le : Vendredi, 31 Août 2007, 16h10mn 12s
Objet : Re : Log4j again... sorry

Thanks for your email,

Still no luck though...
No log happens.
But I can see the SQL request in my MYSQL database logs...

Regards
Gilles

- Message d'origine 
De : Larry Meadors <[EMAIL PROTECTED]
 >
À : user-java@ibatis.apache.org

Envoyé le : Vendredi, 31 Août 2007, 15h09mn 37s
Objet : Re: Log4j again... sorry

Try this:

log4j.logger.java.sql=DEBUG

Larry


On 8/31/07, Gilles Sch