Creacion con el comando clean
This commit is contained in:
101
src/main/java/com/example/hibernate/model/AccMovement.java
Normal file
101
src/main/java/com/example/hibernate/model/AccMovement.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package com.example.hibernate.model;
|
||||
// Generated 24 feb 2026, 18:01:58 by Hibernate Tools 6.6.0.Final
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* AccMovement generated by hbm2java
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="ACC_MOVEMENT"
|
||||
)
|
||||
public class AccMovement implements java.io.Serializable {
|
||||
|
||||
|
||||
private Integer accountMovId;
|
||||
private Account accountByAccountDestId;
|
||||
private Account accountByAccountOriginId;
|
||||
private BigDecimal amount;
|
||||
private Timestamp datetime;
|
||||
|
||||
public AccMovement() {
|
||||
}
|
||||
|
||||
public AccMovement(Account accountByAccountDestId, Account accountByAccountOriginId, BigDecimal amount, Timestamp datetime) {
|
||||
this.accountByAccountDestId = accountByAccountDestId;
|
||||
this.accountByAccountOriginId = accountByAccountOriginId;
|
||||
this.amount = amount;
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
@Id @GeneratedValue(strategy=IDENTITY)
|
||||
|
||||
|
||||
@Column(name="ACCOUNT_MOV_ID", unique=true, nullable=false)
|
||||
public Integer getAccountMovId() {
|
||||
return this.accountMovId;
|
||||
}
|
||||
|
||||
public void setAccountMovId(Integer accountMovId) {
|
||||
this.accountMovId = accountMovId;
|
||||
}
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="ACCOUNT_DEST_ID", nullable=false)
|
||||
public Account getAccountByAccountDestId() {
|
||||
return this.accountByAccountDestId;
|
||||
}
|
||||
|
||||
public void setAccountByAccountDestId(Account accountByAccountDestId) {
|
||||
this.accountByAccountDestId = accountByAccountDestId;
|
||||
}
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="ACCOUNT_ORIGIN_ID", nullable=false)
|
||||
public Account getAccountByAccountOriginId() {
|
||||
return this.accountByAccountOriginId;
|
||||
}
|
||||
|
||||
public void setAccountByAccountOriginId(Account accountByAccountOriginId) {
|
||||
this.accountByAccountOriginId = accountByAccountOriginId;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="AMOUNT", nullable=false, precision=19, scale=4)
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name="DATETIME", nullable=false, length=19)
|
||||
public Timestamp getDatetime() {
|
||||
return this.datetime;
|
||||
}
|
||||
|
||||
public void setDatetime(Timestamp datetime) {
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
104
src/main/java/com/example/hibernate/model/Account.java
Normal file
104
src/main/java/com/example/hibernate/model/Account.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package com.example.hibernate.model;
|
||||
// Generated 24 feb 2026, 18:01:58 by Hibernate Tools 6.6.0.Final
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Account generated by hbm2java
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="ACCOUNT"
|
||||
)
|
||||
public class Account implements java.io.Serializable {
|
||||
|
||||
|
||||
private Integer accountno;
|
||||
private Emp emp;
|
||||
private BigDecimal amount;
|
||||
private Set<AccMovement> accMovementsForAccountDestId = new HashSet<AccMovement>(0);
|
||||
private Set<AccMovement> accMovementsForAccountOriginId = new HashSet<AccMovement>(0);
|
||||
|
||||
public Account() {
|
||||
}
|
||||
|
||||
|
||||
public Account(Emp emp, BigDecimal amount) {
|
||||
this.emp = emp;
|
||||
this.amount = amount;
|
||||
}
|
||||
public Account(Emp emp, BigDecimal amount, Set<AccMovement> accMovementsForAccountDestId, Set<AccMovement> accMovementsForAccountOriginId) {
|
||||
this.emp = emp;
|
||||
this.amount = amount;
|
||||
this.accMovementsForAccountDestId = accMovementsForAccountDestId;
|
||||
this.accMovementsForAccountOriginId = accMovementsForAccountOriginId;
|
||||
}
|
||||
|
||||
@Id @GeneratedValue(strategy=IDENTITY)
|
||||
|
||||
|
||||
@Column(name="ACCOUNTNO", unique=true, nullable=false)
|
||||
public Integer getAccountno() {
|
||||
return this.accountno;
|
||||
}
|
||||
|
||||
public void setAccountno(Integer accountno) {
|
||||
this.accountno = accountno;
|
||||
}
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="EMPNO", nullable=false)
|
||||
public Emp getEmp() {
|
||||
return this.emp;
|
||||
}
|
||||
|
||||
public void setEmp(Emp emp) {
|
||||
this.emp = emp;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="AMOUNT", nullable=false, precision=19, scale=4)
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, mappedBy="accountByAccountDestId")
|
||||
public Set<AccMovement> getAccMovementsForAccountDestId() {
|
||||
return this.accMovementsForAccountDestId;
|
||||
}
|
||||
|
||||
public void setAccMovementsForAccountDestId(Set<AccMovement> accMovementsForAccountDestId) {
|
||||
this.accMovementsForAccountDestId = accMovementsForAccountDestId;
|
||||
}
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, mappedBy="accountByAccountOriginId")
|
||||
public Set<AccMovement> getAccMovementsForAccountOriginId() {
|
||||
return this.accMovementsForAccountOriginId;
|
||||
}
|
||||
|
||||
public void setAccMovementsForAccountOriginId(Set<AccMovement> accMovementsForAccountOriginId) {
|
||||
this.accMovementsForAccountOriginId = accMovementsForAccountOriginId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
85
src/main/java/com/example/hibernate/model/Dept.java
Normal file
85
src/main/java/com/example/hibernate/model/Dept.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package com.example.hibernate.model;
|
||||
// Generated 24 feb 2026, 18:01:58 by Hibernate Tools 6.6.0.Final
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Dept generated by hbm2java
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="DEPT"
|
||||
)
|
||||
public class Dept implements java.io.Serializable {
|
||||
|
||||
|
||||
private Integer deptno;
|
||||
private String dname;
|
||||
private String loc;
|
||||
private Set<Emp> emps = new HashSet<Emp>(0);
|
||||
|
||||
public Dept() {
|
||||
}
|
||||
|
||||
public Dept(String dname, String loc, Set<Emp> emps) {
|
||||
this.dname = dname;
|
||||
this.loc = loc;
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
@Id @GeneratedValue(strategy=IDENTITY)
|
||||
|
||||
|
||||
@Column(name="DEPTNO", unique=true, nullable=false)
|
||||
public Integer getDeptno() {
|
||||
return this.deptno;
|
||||
}
|
||||
|
||||
public void setDeptno(Integer deptno) {
|
||||
this.deptno = deptno;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="DNAME", length=20)
|
||||
public String getDname() {
|
||||
return this.dname;
|
||||
}
|
||||
|
||||
public void setDname(String dname) {
|
||||
this.dname = dname;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="LOC", length=20)
|
||||
public String getLoc() {
|
||||
return this.loc;
|
||||
}
|
||||
|
||||
public void setLoc(String loc) {
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, mappedBy="dept")
|
||||
public Set<Emp> getEmps() {
|
||||
return this.emps;
|
||||
}
|
||||
|
||||
public void setEmps(Set<Emp> emps) {
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
178
src/main/java/com/example/hibernate/model/Emp.java
Normal file
178
src/main/java/com/example/hibernate/model/Emp.java
Normal file
@@ -0,0 +1,178 @@
|
||||
package com.example.hibernate.model;
|
||||
// Generated 24 feb 2026, 18:01:58 by Hibernate Tools 6.6.0.Final
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Temporal;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Emp generated by hbm2java
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="EMP"
|
||||
)
|
||||
public class Emp implements java.io.Serializable {
|
||||
|
||||
|
||||
private Integer empno;
|
||||
private Emp emp;
|
||||
private Dept dept;
|
||||
private String ename;
|
||||
private String job;
|
||||
private Date hiredate;
|
||||
private BigDecimal sal;
|
||||
private BigDecimal comm;
|
||||
private Set<Account> accounts = new HashSet<Account>(0);
|
||||
private Set<Project> projects = new HashSet<Project>(0);
|
||||
private Set<Emp> emps = new HashSet<Emp>(0);
|
||||
|
||||
public Emp() {
|
||||
}
|
||||
|
||||
public Emp(Emp emp, Dept dept, String ename, String job, Date hiredate, BigDecimal sal, BigDecimal comm, Set<Account> accounts, Set<Project> projects, Set<Emp> emps) {
|
||||
this.emp = emp;
|
||||
this.dept = dept;
|
||||
this.ename = ename;
|
||||
this.job = job;
|
||||
this.hiredate = hiredate;
|
||||
this.sal = sal;
|
||||
this.comm = comm;
|
||||
this.accounts = accounts;
|
||||
this.projects = projects;
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
@Id @GeneratedValue(strategy=IDENTITY)
|
||||
|
||||
|
||||
@Column(name="EMPNO", unique=true, nullable=false)
|
||||
public Integer getEmpno() {
|
||||
return this.empno;
|
||||
}
|
||||
|
||||
public void setEmpno(Integer empno) {
|
||||
this.empno = empno;
|
||||
}
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="MGR")
|
||||
public Emp getEmp() {
|
||||
return this.emp;
|
||||
}
|
||||
|
||||
public void setEmp(Emp emp) {
|
||||
this.emp = emp;
|
||||
}
|
||||
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@JoinColumn(name="DEPTNO")
|
||||
public Dept getDept() {
|
||||
return this.dept;
|
||||
}
|
||||
|
||||
public void setDept(Dept dept) {
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="ENAME", length=20)
|
||||
public String getEname() {
|
||||
return this.ename;
|
||||
}
|
||||
|
||||
public void setEname(String ename) {
|
||||
this.ename = ename;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="JOB", length=20)
|
||||
public String getJob() {
|
||||
return this.job;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name="HIREDATE", length=10)
|
||||
public Date getHiredate() {
|
||||
return this.hiredate;
|
||||
}
|
||||
|
||||
public void setHiredate(Date hiredate) {
|
||||
this.hiredate = hiredate;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="SAL", precision=15, scale=2)
|
||||
public BigDecimal getSal() {
|
||||
return this.sal;
|
||||
}
|
||||
|
||||
public void setSal(BigDecimal sal) {
|
||||
this.sal = sal;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="COMM", precision=15, scale=2)
|
||||
public BigDecimal getComm() {
|
||||
return this.comm;
|
||||
}
|
||||
|
||||
public void setComm(BigDecimal comm) {
|
||||
this.comm = comm;
|
||||
}
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, mappedBy="emp")
|
||||
public Set<Account> getAccounts() {
|
||||
return this.accounts;
|
||||
}
|
||||
|
||||
public void setAccounts(Set<Account> accounts) {
|
||||
this.accounts = accounts;
|
||||
}
|
||||
|
||||
@ManyToMany(fetch=FetchType.LAZY)
|
||||
@JoinTable(name="PROJECT_EMP", catalog="empresa", joinColumns = {
|
||||
@JoinColumn(name="EMPNO", nullable=false, updatable=false) }, inverseJoinColumns = {
|
||||
@JoinColumn(name="PROJECTNO", nullable=false, updatable=false) })
|
||||
public Set<Project> getProjects() {
|
||||
return this.projects;
|
||||
}
|
||||
|
||||
public void setProjects(Set<Project> projects) {
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
@OneToMany(fetch=FetchType.LAZY, mappedBy="emp")
|
||||
public Set<Emp> getEmps() {
|
||||
return this.emps;
|
||||
}
|
||||
|
||||
public void setEmps(Set<Emp> emps) {
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
82
src/main/java/com/example/hibernate/model/Project.java
Normal file
82
src/main/java/com/example/hibernate/model/Project.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package com.example.hibernate.model;
|
||||
// Generated 24 feb 2026, 18:01:58 by Hibernate Tools 6.6.0.Final
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Project generated by hbm2java
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="PROJECT"
|
||||
)
|
||||
public class Project implements java.io.Serializable {
|
||||
|
||||
|
||||
private Integer projno;
|
||||
private String projname;
|
||||
private Set<Emp> emps = new HashSet<Emp>(0);
|
||||
|
||||
public Project() {
|
||||
}
|
||||
|
||||
|
||||
public Project(String projname) {
|
||||
this.projname = projname;
|
||||
}
|
||||
public Project(String projname, Set<Emp> emps) {
|
||||
this.projname = projname;
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
@Id @GeneratedValue(strategy=IDENTITY)
|
||||
|
||||
|
||||
@Column(name="PROJNO", unique=true, nullable=false)
|
||||
public Integer getProjno() {
|
||||
return this.projno;
|
||||
}
|
||||
|
||||
public void setProjno(Integer projno) {
|
||||
this.projno = projno;
|
||||
}
|
||||
|
||||
|
||||
@Column(name="PROJNAME", nullable=false, length=50)
|
||||
public String getProjname() {
|
||||
return this.projname;
|
||||
}
|
||||
|
||||
public void setProjname(String projname) {
|
||||
this.projname = projname;
|
||||
}
|
||||
|
||||
@ManyToMany(fetch=FetchType.LAZY)
|
||||
@JoinTable(name="PROJECT_EMP", catalog="empresa", joinColumns = {
|
||||
@JoinColumn(name="PROJECTNO", nullable=false, updatable=false) }, inverseJoinColumns = {
|
||||
@JoinColumn(name="EMPNO", nullable=false, updatable=false) })
|
||||
public Set<Emp> getEmps() {
|
||||
return this.emps;
|
||||
}
|
||||
|
||||
public void setEmps(Set<Emp> emps) {
|
||||
this.emps = emps;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
# Database connection settings
|
||||
hibernate.connection.url=
|
||||
hibernate.connection.driver_class=
|
||||
hibernate.connection.username=
|
||||
hibernate.connection.password=
|
||||
# hibernate.connection.url=
|
||||
# hibernate.connection.driver_class=
|
||||
# hibernate.connection.username=
|
||||
# hibernate.connection.password=
|
||||
|
||||
hibernate.connection.url=jdbc:mysql://localhost:3306/empresa
|
||||
hibernate.connection.driver_class=com.mysql.cj.jdbc.Driver
|
||||
hibernate.connection.username=user_empresa
|
||||
hibernate.connection.password=password
|
||||
|
||||
|
||||
# Echo all executed SQL to console
|
||||
hibernate.show_sql=true
|
||||
hibernate.format_sql=true
|
||||
hibernate.highlight_sql=true
|
||||
|
||||
hibernate.default_schema=
|
||||
hibernate.default_schema=empresa
|
||||
hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||
hibernate.hbm2ddl.auto=update
|
||||
hibernate.default_catalog=
|
||||
hibernate.default_catalog=empresa
|
||||
|
||||
hibernate.current_session_context_class=thread
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user