Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to fetch only desired property of bean in hibernate?
- public class User {
- // login info
- private long id;
- private String type;
- private String userName;
- private String password;
- private String securityQuestionStr;
- private String securityAnswer;
- // personal info
- private String firstName;
- private String middleName;
- private String lastName;
- /**
- * <b>{@link GenderType} gender</b>
- */
- private GenderType gender;
- private Date dateOfBirth;
- // other related info
- /**
- * <b>{@link UserType} userType</b>
- */
- private UserType userType;
- // contact info
- private Long mobileNo;
- private Long businessPhoneNo;
- private Long homePhoneNo;
- private Long faxNo;
- private String email;
- private String alternateEmail;
- /**
- * <b>{@link RegistrationStatus} userStatus</b>
- */
- private RegistrationStatus userStatus;
- /**
- * <b>{@link Post} posts</b>
- */
- private String securityAnswerHash;
- private String passwordHash;
- private String encryptedPassword;
- private String encryptedSecurityAnswer;
- private String nationality;
- private String portal;
- private float version;
- private Date createdDate;
- private User createdUser;
- private String createdIP;
- private Date lastModifiedDate;
- private User lastModifiedUser;
- private String lastModifiedIP;
- private boolean recordStatus;
- private String publicKey;
- private String certificateName;
- private String signPublicKey;
- private String signCertificateName;
- private boolean isEtoken;
- public long getId() {
- return id;
- }
- public void setId(long id) {
- this.id = id;
- }
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- 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 String getSecurityQuestionStr() {
- return securityQuestionStr;
- }
- public void setSecurityQuestionStr(String securityQuestionStr) {
- this.securityQuestionStr = securityQuestionStr;
- }
- public String getSecurityAnswer() {
- return securityAnswer;
- }
- public void setSecurityAnswer(String securityAnswer) {
- this.securityAnswer = securityAnswer;
- }
- public String getFirstName() {
- return firstName;
- }
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
- public String getMiddleName() {
- return middleName;
- }
- public void setMiddleName(String middleName) {
- this.middleName = middleName;
- }
- public String getLastName() {
- return lastName;
- }
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- public GenderType getGender() {
- return gender;
- }
- public void setGender(GenderType gender) {
- this.gender = gender;
- }
- public Date getDateOfBirth() {
- return dateOfBirth;
- }
- public void setDateOfBirth(Date dateOfBirth) {
- this.dateOfBirth = dateOfBirth;
- }
- public UserType getUserType() {
- return userType;
- }
- public void setUserType(UserType userType) {
- this.userType = userType;
- }
- public Long getMobileNo() {
- return mobileNo;
- }
- public void setMobileNo(Long mobileNo) {
- this.mobileNo = mobileNo;
- }
- public Long getBusinessPhoneNo() {
- return businessPhoneNo;
- }
- public void setBusinessPhoneNo(Long businessPhoneNo) {
- this.businessPhoneNo = businessPhoneNo;
- }
- public Long getHomePhoneNo() {
- return homePhoneNo;
- }
- public void setHomePhoneNo(Long homePhoneNo) {
- this.homePhoneNo = homePhoneNo;
- }
- public Long getFaxNo() {
- return faxNo;
- }
- public void setFaxNo(Long faxNo) {
- this.faxNo = faxNo;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public String getAlternateEmail() {
- return alternateEmail;
- }
- public void setAlternateEmail(String alternateEmail) {
- this.alternateEmail = alternateEmail;
- }
- public RegistrationStatus getUserStatus() {
- return userStatus;
- }
- public void setUserStatus(RegistrationStatus userStatus) {
- this.userStatus = userStatus;
- }
- public String getSecurityAnswerHash() {
- return securityAnswerHash;
- }
- public void setSecurityAnswerHash(String securityAnswerHash) {
- this.securityAnswerHash = securityAnswerHash;
- }
- public String getPasswordHash() {
- return passwordHash;
- }
- public void setPasswordHash(String passwordHash) {
- this.passwordHash = passwordHash;
- }
- public String getEncryptedPassword() {
- return encryptedPassword;
- }
- public void setEncryptedPassword(String encryptedPassword) {
- this.encryptedPassword = encryptedPassword;
- }
- public String getEncryptedSecurityAnswer() {
- return encryptedSecurityAnswer;
- }
- public void setEncryptedSecurityAnswer(String encryptedSecurityAnswer) {
- this.encryptedSecurityAnswer = encryptedSecurityAnswer;
- }
- public String getNationality() {
- return nationality;
- }
- public void setNationality(String nationality) {
- this.nationality = nationality;
- }
- public String getPortal() {
- return portal;
- }
- public void setPortal(String portal) {
- this.portal = portal;
- }
- public float getVersion() {
- return version;
- }
- public void setVersion(float version) {
- this.version = version;
- }
- public Date getCreatedDate() {
- return createdDate;
- }
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
- }
- public User getCreatedUser() {
- return createdUser;
- }
- public void setCreatedUser(User createdUser) {
- this.createdUser = createdUser;
- }
- public String getCreatedIP() {
- return createdIP;
- }
- public void setCreatedIP(String createdIP) {
- this.createdIP = createdIP;
- }
- public Date getLastModifiedDate() {
- return lastModifiedDate;
- }
- public void setLastModifiedDate(Date lastModifiedDate) {
- this.lastModifiedDate = lastModifiedDate;
- }
- public User getLastModifiedUser() {
- return lastModifiedUser;
- }
- public void setLastModifiedUser(User lastModifiedUser) {
- this.lastModifiedUser = lastModifiedUser;
- }
- public String getLastModifiedIP() {
- return lastModifiedIP;
- }
- public void setLastModifiedIP(String lastModifiedIP) {
- this.lastModifiedIP = lastModifiedIP;
- }
- public boolean isRecordStatus() {
- return recordStatus;
- }
- public void setRecordStatus(boolean recordStatus) {
- this.recordStatus = recordStatus;
- }
- public String getPublicKey() {
- return publicKey;
- }
- public void setPublicKey(String publicKey) {
- this.publicKey = publicKey;
- }
- public String getCertificateName() {
- return certificateName;
- }
- public void setCertificateName(String certificateName) {
- this.certificateName = certificateName;
- }
- public String getSignPublicKey() {
- return signPublicKey;
- }
- public void setSignPublicKey(String signPublicKey) {
- this.signPublicKey = signPublicKey;
- }
- public String getSignCertificateName() {
- return signCertificateName;
- }
- public void setSignCertificateName(String signCertificateName) {
- this.signCertificateName = signCertificateName;
- }
- public boolean isEtoken() {
- return isEtoken;
- }
- public void setEtoken(boolean isEtoken) {
- this.isEtoken = isEtoken;
- }
- Query query = session
- .createQuery("select new User(id, userName) from User where id=?");
- query.setParameter(0, 1l);
- DataBaseUtil.createPropertySpecificQuery(Clazz entity, String[] properties, String[] conditionParams, String[] conditionOperators){} write a logic to build query.
Add Comment
Please, Sign In to add comment