📄 userprofile.java
字号:
/*
* Copyright 2006 Borys Burnayev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rdacorp.petstore.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;
/**
* @author Borys Burnayev
*/
@Entity
@Table(name = "user_profile")
@SequenceGenerator(name = "UserProfileSeq", sequenceName = "sq_user_profile")
public class UserProfile {
private Integer userProfileId;
private String login;
private String password;
private Person person;
private int version;
@Column(name = "row_version")
@Version
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public UserProfile(String login, String password, Person person) {
this.login = login;
this.password = password;
this.person = person;
person.setUserProfile(this);
}
public UserProfile() {
}
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "UserProfileSeq")
@Column(name = "user_profile_sysid")
public Integer getUserProfileId() {
return this.userProfileId;
}
public void setUserProfileId(Integer userProfileId) {
this.userProfileId = userProfileId;
}
@Column(name = "logon_id")
public String getLogin() {
return this.login;
}
public void setLogin(String login) {
this.login = login;
}
@Column(name = "encr_pass_cd")
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@OneToOne
@JoinColumn(name = "person_sysid")
public Person getPerson() {
return this.person;
}
public void setPerson(Person person) {
this.person = person;
}
public String toString() {
String id = userProfileId != null ? userProfileId.toString() : "<no ID>";
return "User Profile " + id + ":\nLogin: " + login + "\nPassword: " + password + "\n" + person;
}
public boolean equals(Object object) {
if (!(object instanceof UserProfile))
return false;
UserProfile userProfile = (UserProfile) object;
return login.equals(userProfile.getLogin());
}
public int hashCode() {
return login.hashCode();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -