-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Have to SQL select twice
PostPosted: Tue Apr 19, 2005 12:51 pm 
Beginner
Beginner

Joined: Tue Feb 08, 2005 1:29 pm
Posts: 20
Hi,

I am describing you the following scenario:
1) Use a php page to enter a new user inside my table.
2) Use my JBOSS application to inquiry my user through the following line of code:
private OutMessage login(SuDeTPSession s, UserLoginMsg msg)
throws BaseException {
User user;
String username = (String) msg.getField(UserLoginMsg.USERNAME);
String pwd = (String) msg.getField(UserLoginMsg.PWD);

try {
List users = s.session.createCriteria(
User.class).add(
Expression.eq("userName", username)).list();

// Users are unique per userId or username (see registration process).
if (users != null && users.size() > 0) {
user = (User) users.get(0);
} else {
throw new BaseException(ErrorIds.USER_INVALID_USER);
}
} catch (HibernateException ex) {
throw new BaseException(ErrorIds.USER_INVALID_USER, ex);
}

if (!HashUtil.getMD5(pwd).equals(user.getPassword())) {
throw new BaseException(ErrorIds.USER_INVALID_USER_PWD);
}

if (user.getStatus().equals(IUser.PENDING_REGISTRATION)) {
throw new BaseException(ErrorIds.USER_PENDING_USER);
}

msg.setField(UserLoginMsg.USER, user);

return msg;
}

I need to call this method twice to see the new users I just entered.
Here is my configuration file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">xxx</property>
<property name="connection.password">xxx</property>
<property name="connection.url">jdbc:mysql://localhost/sudetp</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">@hibernate-showsql@</property>
<property name="cglib.use_reflection_optimizer">true</property>

<!-- mapping files -->
<mapping resource="com/etil/sudetp/business/manager/user/impl/User.hbm.xml" />
</session-factory>
</hibernate-configuration>

AM I MISSING SOMETHING WITH THE CACHING?

Thanks.
David


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 2:57 pm 
Beginner
Beginner

Joined: Tue Feb 08, 2005 1:29 pm
Posts: 20
No one with a bit of a clue?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2005 2:58 pm 
Beginner
Beginner

Joined: Tue Feb 08, 2005 1:29 pm
Posts: 20
Has anyone ever faced that problem?

I have PHP updated my database, but when accessing through Hibernate, I need to go twice through my login process to see my new users in the database.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2005 4:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
doesnt sounds like a hibernate problem, but more as caching issue or something.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.