Hello everybody,
I'am using ejb 3 with jboss AS 4.0.2 .I have created an entity bean
import java.io.Serializable;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.dte.incentiveGroup.ejb.IncentiveGroupPO;
import com.dte.incentivePlan.ejb.IncentivePlanPO;
import com.dte.user.ejb.EmployeePO;
@Entity
@Table(name = "Employee_Grant")
public class EmployeeGrantPO implements Serializable{
Integer employeeGrantID;
private IncentiveGroupPO incentiveGroupID;
private EmployeePO employeeID;
private IncentivePlanPO incentivePlanID;
private GrantPO grantPO;
Integer companyID;
Float AIPPer;
Integer sharesOriginal;
String activeYN;
String createdBY;
Date createdDT;
String modifiedBY;
Date modifiedDT;
@Column(name="Active_Y_N")
public String getActiveYN() {
return activeYN;
}
public void setActiveYN(String activeYN) {
this.activeYN = activeYN;
}
@Column(name="AIP_Pct")
public Float getAIPPer() {
return AIPPer;
}
public void setAIPPer(Float per) {
AIPPer = per;
}
@Column(name="Company_ID")
public Integer getCompanyID() {
return companyID;
}
public void setCompanyID(Integer companyID) {
this.companyID = companyID;
}
@Column(name="Created_By")
public String getCreatedBY() {
return createdBY;
}
public void setCreatedBY(String createdBY) {
this.createdBY = createdBY;
}
@Column(name="Created_Dt")
public Date getCreatedDT() {
return createdDT;
}
public void setCreatedDT(Date createdDT) {
this.createdDT = createdDT;
}
@Id
@Column(name="Employee_Grant_ID")
public Integer getEmployeeGrantID() {
return employeeGrantID;
}
public void setEmployeeGrantID(Integer employeeGrantID) {
this.employeeGrantID = employeeGrantID;
}
@ManyToOne
@JoinColumn(name = "Employee_ID")
public EmployeePO getEmployeeID() {
return employeeID;
}
public void setEmployeeID(EmployeePO employeeID) {
this.employeeID = employeeID;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Grant_ID")
public GrantPO getGrantPO() {
return grantPO;
}
public void setGrantPO(GrantPO grantID) {
this.grantPO = grantID;
}
@ManyToOne
@JoinColumn(name="Incentive_Group_Id")
public IncentiveGroupPO getIncentiveGroupID() {
return incentiveGroupID;
}
public void setIncentiveGroupID(IncentiveGroupPO incentiveGroupID) {
this.incentiveGroupID = incentiveGroupID;
}
@ManyToOne
@JoinColumn(name = "Incentive_Plan_ID")
public IncentivePlanPO getIncentivePlanID() {
return incentivePlanID;
}
public void setIncentivePlanID(IncentivePlanPO incentivePlanID) {
this.incentivePlanID = incentivePlanID;
}
@Column(name="Modifyed_By")
public String getModifiedBY() {
return modifiedBY;
}
public void setModifiedBY(String modifiedBY) {
this.modifiedBY = modifiedBY;
}
@Column(name="Modifyed_Dt")
public Date getModifiedDT() {
return modifiedDT;
}
public void setModifiedDT(Date modifiedDT) {
this.modifiedDT = modifiedDT;
}
@Column(name="Shares_Original")
public Integer getSharesOriginal() {
return sharesOriginal;
}
public void setSharesOriginal(Integer sharesOriginal) {
this.sharesOriginal = sharesOriginal;
}
}
and a session bean
import java.io.Serializable;
import javax.ejb.Remote;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateful
@Remote(EmployeeGrant.class)
public class EmployeeGrantBean implements EmployeeGrant,Serializable{
@PersistenceContext
private EntityManager manager;
RestrictedGrantInfo restrictedGrantInfo = null;
EmployeeGrantPO employeeGrantPO = null;
public EmployeeGrantPO getEmployeeGrant(String employeeSSN){
System.out.println("Inside EmployeeGrantPO getEmployeeGrant for
employeeSSN = "+employeeSSN);
System.out.println("manager = "+manager);
employeeGrantPO = (EmployeeGrantPO)manager.createQuery("select
employeeGrantPO from EmployeeGrantPO employeeGrantPO where
employeeGrantPO.employeeID
=:value").setParameter("value",employeeSSN).getSingleResult();
System.out.println("Returning from EmployeeGrantPO
getEmployeeGrant employeeGrantPO = "+employeeGrantPO);
return employeeGrantPO;
}
}
the problem is that when try to fire the method on EntityManager manager
the manager is null.
My question is what wrong an i doing that the value of EntityManager manager is
null??
I humbly look forward to your guidence.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914420#3914420
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914420
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user