Vish Murthy

Greenhorn
+ Follow
since Jan 09, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Vish Murthy

Can any one respond to my question please
I missed to past persistence.xml

[code] <?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name ="PATPersistence">
<jta-data-source>jdbc/PATDataSource</jta-data-source>
</persistence-unit>
</persistence>
[/code]
Hi,

I am facing problem when I try to insert the record by using entity been. I am getting an error at the place “manager.persist(cust);” in EmployeeBean class.

I tried to fix this problem for three days but I am not able to fix. Can any one to help me to fix this problem please

[code] Error Stack is this

[#|2010-01-28T21:29:13.000-0600|INFO|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MiniProject/MiniProjectEJB_jar/-PATPersistence|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 5;|TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))|#]

[#|2010-01-28T21:29:13.031-0600|INFO|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MiniProject/MiniProjectEJB_jar/-PATPersistence|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 5;|Server: unknown|#]

[#|2010-01-28T21:29:22.468-0600|INFO|sun-appserver9.1|oracle.toplink.essentials.session.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MiniProject/MiniProjectEJB_jar/-PATPersistence|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 5;|file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MiniProject/MiniProjectEJB_jar/-PATPersistence login successful|#]

[#|2010-01-28T21:29:22.828-0600|INFO|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 5;EmployeeBean;|EJB5018: An exception was thrown during an ejb invocation on [EmployeeBean]|#]

[#|2010-01-28T21:29:22.828-0600|INFO|sun-appserver9.1|javax.enterprise.system.container.ejb|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 5;|
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
at $Proxy32.doAction(Unknown Source)
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:585)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: java.lang.IllegalArgumentException: Object: SampleEntity.Customer@115441f is not a known entity type.
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3212)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:205)
at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:440)
at SampleEntity.EmployeeBean.doAction(EmployeeBean.java:31)
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:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
... 17 more
|#]


[/code]

[code] @Entity
@Table(name = "CUSTOMER_TABLE")
public class Customer implements java.io.Serializable {
private int id;
private String lastName;
private String firstName;
private Date timeCreated = new Date();

@Id
@Column(name = "CUST_ID", nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)

public int getId() {
return id;
}

public void setId(int pk) {
id = pk;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}


public Date getTimeCreated() {
return timeCreated;
}

public void setTimeCreated(Date time) {
timeCreated = time;
}

}

[/code]

[code] @Stateless

public class EmployeeBean implements EmployeeServiceRemote {

@PersistenceContext(unitName="PATPersistence")
private EntityManager manager;

public EmployeeBean()
{
}

@TransactionAttribute(TransactionAttributeType.REQUIRED)

public void doAction()
{
Customer cust = new Customer();

cust.setFirstName("Joe");
manager.persist(cust);

System.out.println("Saved");

cust = manager.find(Customer.class,cust.getId());

System.out.println(cust.getFirstName());

}

}

[/code]

[code] @Remote
public interface EmployeeServiceRemote {
public void doAction();
}

[/code]

[code] public class Main {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

EmployeeServiceRemote service = null;

try{
service = (EmployeeServiceRemote) new InitialContext().lookup("SampleEntity.EmployeeServiceRemote");
service.doAction();
}catch (Exception e) {
System.out.println(e.getStackTrace());
}


}

}
[/code]
Hi,

I do not know how to do. Can you please advise me how to resolve? My requirement is

1. I have three columns in the logic:iterate tag contains 10 records currently but it can change dynamically

InputValue, Customer ID (this is a hyper link), Customer Name

2. I want to recognize that record either user enters any value in the InputValue column or click on that link


Example 1

InputValue Customer ID Customer Name
101010 Test1
101011 Test2
101013 Test3

If I click on the second link from customer ID, then I should recognize the complete record (Null, 101011, Test2)

Example 2

InputValue Customer ID Customer Name
101010 Test1
101011 Test2
Input3 101013 Test3


If I enter the value in the third record, then I should recognize the complete record (Input3, 101013, Test3)


My JSP code
14 years ago
[code]

Hi,

I am getting an error "javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm" can any one help please. I am pasting my code

struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">


<struts-config>


<!-- ================================================ Form Bean Definitions -->

<!-- ================================================ Form Bean Definitions -->

<form-beans>

<form-bean
name="LoginForm" type="Login.LoginForm" >
</form-bean>

</form-beans>



<!-- ========================================= Global Exception Definitions -->

<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->

</global-exceptions>


<!-- =========================================== Global Forward Definitions -->

<global-forwards>

<!-- <forward name="/login" path="/jsp/login.html" /> -->
</global-forwards>


<!-- =========================================== Action Mapping Definitions -->

<action-mappings>

<action path="/loginPage" validation="false" input="/index.jsp" name="LoginForm" type="Login.LoginAction" parameter="method">
<forward name="success" path="/Jsp/MainPage.jsp" />
</action>

</action-mappings>


<!-- ======================================== Message Resources Definitions -->

<!-- <message-resources parameter="com.heb.operations.odc.pat.resources.ApplicationResources" /> -->


<!-- =================================================== Validator plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/org/apache/struts/validator/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>



index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page language="java" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<html:form action="/loginPage" method="post">
<table align="center">
<tr>
<td><B>Mini Project</B> </td>
</tr>
</table>


<table align="center">

<tr>
<td> Login </td>
<td>
<html:text property="id"> </html:text>
</td>
</tr>
<tr>
<td>Password </td>
<td><html:text property= "pass"> </html:text></td>
</tr>

<tr>
<td></td>
<td>
<html:submit>Submit</html:submit>
</td>

</table>
</html:form>
</body>
</html>


FORM


package Login;

import org.apache.struts.action.ActionForm;


public class LoginForm extends ActionForm{

private String id ;
private String pass;
private String errorDesc;

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getErrorDesc() {
return errorDesc;
}
public void setErrorDesc(String errorDesc) {
this.errorDesc = errorDesc;
}
}


ACTION

package Login;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class LoginAction extends DispatchAction{


public ActionForward vlidateLogin(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
{

System.out.println("Test");
return mapping.findForward("success");

}

}



[/code]
14 years ago