Кто нибудь сталкивался с проблемой Есть сущностные классы Код | @Entity @NamedQueries({ @NamedQuery(name = "Employee.findAll", query = "Select empl from Employee empl"), @NamedQuery(name = "Employee.findByID", query = "Select empl from Employee empl where empl.id=:empID") }) public class Employee implements Serializable {
private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(nullable = false) private String firstName; @Column(nullable = false) private String lastName; @Column(nullable = false) private String patronimycName; @Temporal(javax.persistence.TemporalType.DATE) private Date birthDate; @ManyToOne private Department department; @Temporal(javax.persistence.TemporalType.DATE) private Date hireDate;
/** * Get the value of birthDate * * @return the value of birthDate */ public Date getBirthDate() { return birthDate; }
/** * Set the value of birthDate * * @param birthDate new value of birthDate */ public void setBirthDate(Date birthDate) { this.birthDate = birthDate; }
/** * Get the value of patronimycName * * @return the value of patronimycName */ public String getPatronimycName() { return patronimycName; }
/** * Set the value of patronimycName * * @param patronimycName new value of patronimycName */ public void setPatronimycName(String patronimycName) { this.patronimycName = patronimycName; }
/** * Get the value of lastName * * @return the value of lastName */ public String getLastName() { return lastName; }
/** * Set the value of lastName * * @param lastName new value of lastName */ public void setLastName(String lastName) { this.lastName = lastName; }
/** * Get the value of firstName * * @return the value of firstName */ public String getFirstName() { return firstName; }
/** * Set the value of firstName * * @param firstName new value of firstName */ public void setFirstName(String firstName) { this.firstName = firstName; }
/** * Get the value of hireDate * * @return the value of hireDate */ public Date getHireDate() { return hireDate; }
/** * Set the value of hireDate * * @param hireDate new value of hireDate */ public void setHireDate(Date hireDate) { this.hireDate = hireDate; }
/** * Get the value of department * * @return the value of department */ public Department getDepartment() { return department; }
/** * Set the value of department * * @param department new value of department */ public void setDepartment(Department department) { this.department = department; }
public void setId(Long id) { this.id = id; }
public Long getId() { return id; } }
@Entity @NamedQueries({ @NamedQuery(name = "Department.findAll", query = "Select dpt from Department dpt"), @NamedQuery(name = "Department.findByID", query = "Select dpt from Department dpt where dpt.id=:deptID") }) public class Department implements Serializable {
private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(nullable = false) private String departmentName;
/** * Get the value of departmentName * * @return the value of departmentName */ public String getDepartmentName() { return departmentName; }
/** * Set the value of departmentName * * @param departmentName new value of departmentName */ public void setDepartmentName(String departmentName) { this.departmentName = departmentName; }
public Long getID() { return this.id; }
public void setId(Long id) { this.id = id; } }
|
+ как обычно фасады к ним. когда в приложении пишу: Код | Department dept = new Department(); dept.setDepartmentName("SomeDepartment")
Employee empl = new Employee(); empl.setDepartment(dept) emplLocalFacade.create(empl);
|
мне дает ошибку вот такую java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:438) at org.glassfish.appclient.client.AppClientFacade.main(AppClientFacade.java:165) Caused by: javax.ejb.EJBAccessException.....................
сервер приложений Oracle Glassfish, IDE Netbeans 7.1
|