Package net.devmanuals.model

Package net.devmanuals.model


Posted in : Spring Posted on : March 30, 2011 at 12:39 PM Comments : [ 0 ]

The classes inside Package net.devmanuals.model is used by the Hibernate API to create table.

Package net.devmanuals.model

The classes inside Package net.devmanuals.model is used by the Hibernate API to create table. The structure of the net.devmanuals.model package and code of each class with description is given below :

Admin.java

This class is used by Hibernate API to create admin table.

package net.devmanuals.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@SuppressWarnings("serial")
@Table(name = "admin")
public class Admin {

@Id
@GeneratedValue
@Column(name = "admin_id")
private Long adminId;

@Column(name = "admin_name")
private String adminName;

@NotEmpty
@Column(name = "admin_email")
private String adminEmail;

@NotEmpty
@Column(name = "password")
private String password;

public void setAdminId(Long adminId) {
this.adminId = adminId;
}

public Long getAdminId() {
return adminId;
}

public void setAdminName(String adminName) {
this.adminName = adminName;
}

public String getAdminName() {
return adminName;
}

public void setAdminEmail(String adminEmail) {
this.adminEmail = adminEmail;
}

public String getAdminEmail() {
return adminEmail;
}

public void setPassword(String password) {
this.password = password;
}

public String getPassword() {
return password;
}
}

Language.java

This class is used by Hibernate API to create language table.

package net.devmanuals.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@SuppressWarnings("serial")
@Table(name = "language")
public class Language {

@Id
@GeneratedValue
@Column(name = "lang_id")
private Long languageId;

@Column(name = "lang_name")
private String languageName;

public void setLanguageId(Long languageId) {
this.languageId = languageId;
}

public Long getLanguageId() {
return languageId;
}

public void setLanguageName(String languageName) {
this.languageName = languageName;
}

public String getLanguageName() {
return languageName;
}
}

QuestionOptions.java

This class is used by Hibernate API to create question_options table.

package net.devmanuals.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;

@Entity
@SuppressWarnings("serial")
@Table(name = "question_options")
public class QuestionOptions {

@Id
@GeneratedValue
@Column(name = "ques_op_id")
private Long quesOpId;

@Column(name = "ans_description")
private String ansDescription;

@Column(name = "ques_id")
private Long questionId;

public void setQuesOpId(Long quesOpId) {
this.quesOpId = quesOpId;
}

public Long getQuesOpId() {
return quesOpId;
}

public void setAnsDescription(String ansDescription) {
this.ansDescription = ansDescription;
}

public String getAnsDescription() {
return ansDescription;
}

public void setQuestionId(Long questionId) {
this.questionId = questionId;
}

public Long getQuestionId() {
return questionId;
}
}

Questions.java

This class is used by Hibernate API to create questions table.

package net.devmanuals.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;

@Entity
@SuppressWarnings("serial")
@Table(name = "questions")
public class Questions {

@Id
@GeneratedValue
@Column(name = "ques_id")
private Long questionId;

@Column(name = "lang_id")
private Long languageId;

@Column(name = "question")
private String question;

@Column(name = "right_option")
private Long rightOption;

public void setQuestionId(Long questionId) {
this.questionId = questionId;
}

public Long getQuestionId() {
return questionId;
}

public void setLanguageId(Long languageId) {
this.languageId = languageId;
}

public Long getLanguageId() {
return languageId;
}

public void setQuestion(String question) {
this.question = question;
}

public String getQuestion() {
return question;
}

public void setRightOption(Long rightOption) {
this.rightOption = rightOption;
}

public Long getRightOption() {
return rightOption;
}
}

User.java

This class is used by Hibernate API to create users table. 

package net.devmanuals.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;

@Entity
@SuppressWarnings("serial")
@Table(name = "user")
public class User {

@Id
@GeneratedValue
@Column(name = "user_id")
private Long userId;

@Column(name = "user_name")
private String userName;

@Column(name = "user_email")
private String userEmail;

@Column(name = "password")
private String password;

@Column(name = "gender")
private String userGender;

@Column(name = "phone_no")
private String phoneNo;

@Column(name = "address")
private String address;

public void setUserId(Long userId) {
this.userId = userId;
}

public Long getUserId() {
return userId;
}

public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}

public String getUserEmail() {
return userEmail;
}

public void setUserName(String userName) {
this.userName = userName;
}

public String getUserName() {
return userName;
}

public void setPassword(String password) {
this.password = password;
}

public String getPassword() {
return password;
}

public void setUserGender(String userGender) {
this.userGender = userGender;
}

public String getUserGender() {
return userGender;
}

public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}

public String getPhoneNo() {
return phoneNo;
}

public void setAddress(String address) {
this.address = address;
}

public String getAddress() {
return address;
}
}

Click here to go back to main page

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics