Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread Larry Meadors
Maybe with some info.

Using ibatis2 or 3?

Can you provide your mapped statement?

Throw us a bone here. :P

Larry


On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote:

 I have in the table a boolean (tinyint(1)) value. I don't know why, but
 ibatis always gets it as true, whether it is 0, or 1 in database.

 Who knows what is the cause?
 --
 View this message in context: 
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread vadboss

It's IBatis 3.

Here is the statement:
select id=selectByUsernameAndPassword parameterType=domain.ClockUser
resultType=domain.ClockUser
SELECT users.id, users.username, users.password,
MAX(clock_operations.date) as lastActionDate,
clock_operations.clock_in as clockedIn
FROM users,
clock_operations
WHERE users.id=clock_operations.user_id AND 
users.username=#{username}
AND users.password=#{password};
/select



Larry Meadors wrote:
 
 Maybe with some info.
 
 Using ibatis2 or 3?
 
 Can you provide your mapped statement?
 
 Throw us a bone here. :P
 
 Larry
 
 
 On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote:

 I have in the table a boolean (tinyint(1)) value. I don't know why, but
 ibatis always gets it as true, whether it is 0, or 1 in database.

 Who knows what is the cause?
 --
 View this message in context:
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434308.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread Larry Meadors
and domain.ClockUser is?

On Mon, May 3, 2010 at 5:59 AM, vadboss vadb...@gmail.com wrote:

 It's IBatis 3.

 Here is the statement:
 select id=selectByUsernameAndPassword parameterType=domain.ClockUser
                resultType=domain.ClockUser
                SELECT users.id, users.username, users.password,
                MAX(clock_operations.date) as lastActionDate,
                clock_operations.clock_in as clockedIn
                FROM users,
                clock_operations
                WHERE users.id=clock_operations.user_id AND 
 users.username=#{username}
                AND users.password=#{password};
 /select



 Larry Meadors wrote:

 Maybe with some info.

 Using ibatis2 or 3?

 Can you provide your mapped statement?

 Throw us a bone here. :P

 Larry


 On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote:

 I have in the table a boolean (tinyint(1)) value. I don't know why, but
 ibatis always gets it as true, whether it is 0, or 1 in database.

 Who knows what is the cause?
 --
 View this message in context:
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



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




 --
 View this message in context: 
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434308.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread vadboss

package domain;

import java.util.Date;

public class ClockUser {

private int id;
private String username;
private String password;
private boolean clockedIn;
private Date lastActionDate;

public ClockUser() {
lastActionDate = new Date();
}

public ClockUser(String username, String password) {
this();
this.username = username;
this.password = password;
}

public ClockUser(int id, String username, String password,
boolean clockedIn, Date lastActionDate) {
this.id = id;
this.username = username;
this.password = password;
this.clockedIn = clockedIn;
this.lastActionDate = lastActionDate;
}

public void resetLastActionDateToCurrent() {
lastActionDate = new Date();
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public boolean isClockedIn() {
return clockedIn;
}

public void setClockedIn(boolean clockedIn) {
this.clockedIn = clockedIn;
}

public Date getLastActionDate() {
return lastActionDate;
}

public void setLastActionDate(Date lastActionDate) {
this.lastActionDate = lastActionDate;
}
}




Larry Meadors wrote:
 
 and domain.ClockUser is?
 
 On Mon, May 3, 2010 at 5:59 AM, vadboss vadb...@gmail.com wrote:

 It's IBatis 3.

 Here is the statement:
 select id=selectByUsernameAndPassword parameterType=domain.ClockUser
                resultType=domain.ClockUser
                SELECT users.id, users.username, users.password,
                MAX(clock_operations.date) as lastActionDate,
                clock_operations.clock_in as clockedIn
                FROM users,
                clock_operations
                WHERE users.id=clock_operations.user_id AND
 users.username=#{username}
                AND users.password=#{password};
 /select



 Larry Meadors wrote:

 Maybe with some info.

 Using ibatis2 or 3?

 Can you provide your mapped statement?

 Throw us a bone here. :P

 Larry


 On Mon, May 3, 2010 at 3:09 AM, vadboss vadb...@gmail.com wrote:

 I have in the table a boolean (tinyint(1)) value. I don't know why, but
 ibatis always gets it as true, whether it is 0, or 1 in database.

 Who knows what is the cause?
 --
 View this message in context:
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28432952.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



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




 --
 View this message in context:
 http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434308.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434375.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread Larry Meadors
OK, so you have a boolean in your bean, and a tinyint in your database
and it's getting mapped to true regardless of the int value.

What about insert/update? Are they setting the database to 0 and 1, or
always using the same value?

Larry

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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread vadboss

insert id=clockUserIn parameterType=domain.ClockUser
INSERT INTO
clock_operations (user_id, date, clock_in)
VALUES (#{id},
#{lastActionDate}, true)
/insert

insert id=clockUserOut parameterType=domain.ClockUser
INSERT INTO
clock_operations (user_id, date, clock_in)
VALUES (#{id},
#{lastActionDate}, false)
/insert

This works ok. FOr the first case it inserts 1 and 0 for the second
statement.




Larry Meadors wrote:
 
 OK, so you have a boolean in your bean, and a tinyint in your database
 and it's getting mapped to true regardless of the int value.
 
 What about insert/update? Are they setting the database to 0 and 1, or
 always using the same value?
 
 Larry
 
 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/IBatis%3A-boolean-mapping-misunderstanding-tp28432952p28434560.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



Re: IBatis: boolean mapping misunderstanding

2010-05-03 Thread Guy Rouillier

On 5/3/2010 5:09 AM, vadboss wrote:


I have in the table a boolean (tinyint(1)) value. I don't know why, but
ibatis always gets it as true, whether it is 0, or 1 in database.

Who knows what is the cause?


You provided very little information.  What version of iBATIS?  What 
database and version?  What does the SQL and the ResultMap look like? 
I'm doing this successfully with Oracle 10g and iBATIS 3.


--
Guy Rouillier

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



Ibatis 3 - Lazy Loading and Serializable Sessions

2010-05-03 Thread moffit

Hi,

  I noticed that this question was asked a few years ago with Ibatis 2.X
without any resolution.

  Basically, lazy loaded objects are enhanced with byte-code generation. 
The enhanced object/proxy is not serializable even though the source object
is.  This obviously plays havoc with web applications if the source object
is stored in the session.  A very simple and probably often used scenario
would be a user object that contains a contact object which contains a
location, etc.., stored in the session after authentication.  Lazy loading
can be very useful in situations like this, but the session cannot be
serialized to disk by the container (e.g. Tomcat).  This negates clustering,
for one, thing, and is also a pain for development, as the context is often
reloaded due to code changes.  Without the serialization support, the
developer must plow through the entire log on and resulting work-flow to get
to the required web page again.

Are there any technical or architectural issues around making the enhanced
object serializable?  Has anyone else run into this problem?  Right now,
I've disabled lazy loading to allow the session to be serialized.

Thanks,

Mike
-- 
View this message in context: 
http://old.nabble.com/Ibatis-3---Lazy-Loading-and-Serializable-Sessions-tp28442042p28442042.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



Re: Ibatis 3 - Lazy Loading and Serializable Sessions

2010-05-03 Thread Clinton Begin
iBATIS 3 enhanced objects should be serializable.  Can you post the
exception you're getting?

Clinton

On Mon, May 3, 2010 at 7:25 PM, moffit mof...@gmail.com wrote:

 Hi,

  I noticed that this question was asked a few years ago with Ibatis 2.X
 without any resolution.

  Basically, lazy loaded objects are enhanced with byte-code generation.
 The enhanced object/proxy is not serializable even though the source object
 is.  This obviously plays havoc with web applications if the source object
 is stored in the session.  A very simple and probably often used scenario
 would be a user object that contains a contact object which contains a
 location, etc.., stored in the session after authentication.  Lazy loading
 can be very useful in situations like this, but the session cannot be
 serialized to disk by the container (e.g. Tomcat).  This negates clustering,
 for one, thing, and is also a pain for development, as the context is often
 reloaded due to code changes.  Without the serialization support, the
 developer must plow through the entire log on and resulting work-flow to get
 to the required web page again.

 Are there any technical or architectural issues around making the enhanced
 object serializable?  Has anyone else run into this problem?  Right now,
 I've disabled lazy loading to allow the session to be serialized.

 Thanks,

 Mike
 --
 View this message in context: 
 http://old.nabble.com/Ibatis-3---Lazy-Loading-and-Serializable-Sessions-tp28442042p28442042.html
 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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



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