-->
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.  [ 3 posts ] 
Author Message
 Post subject: Property Hiding
PostPosted: Fri Jul 15, 2005 6:02 am 
Newbie

Joined: Tue Jul 12, 2005 9:50 pm
Posts: 7
I am new to Hibernate, please help me the solving the below problem.

How to hide some properties from a persistance object?
I have login table containing the userid, password and other userinformation columns. I need to retrive the persistance object based on the userid and compare the password in the session bean. if successful the persistance object should be sent to the presentation tier.
But now my problem is when I send the object to the presentation tier, the object also contains the Password which is supposed to be protected. Is there any way to hide just password field alone from a persistant object.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 6:35 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
use Transfer Object.

Code:
public class LoginTo {
    private Long id;
    private String userName;

    public LoginTo(Long id, String userName) {
      .....
    }
....
...
}


The following query returns constructed Transfer Object (LoginTo):
Code:
select new LoginTo(login.id, login.userName) from Login
where login.userName=? AND login.isActive=?


So your Login.password will not got to the representation tire.

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 6:37 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
As you got it should be Login login:
Code:
select new LoginTo(login.id, login.userName) from Login login
where login.userName=? AND login.isActive=?

_________________
Leonid Shlyapnikov


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.