Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams
this week in the
Agile and Other Processes
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Devaka Cooray
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Jeanne Boyarsky
Tim Cooke
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Bartenders:
Forum:
Object Relational Mapping
IBatis: boolean mapping misunderstanding
Vadim Vararu
Ranch Hand
Posts: 147
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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?
If you think you've done too much, usually it means you've done too few.
David Newton
Author
Posts: 12617
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How did you map it?
Vadim Vararu
Ranch Hand
Posts: 147
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is the code:
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; } }
<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>
If you think you've done too much, usually it means you've done too few.
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
iBATIS imposing design
[SOLVED] This is going to drive me nuts
how to print ibatis query on console
what is a N+1 problem spefically i have seen this in iBatis
Tech Word Game
More...