Hi,
I'm trying to access a datatime field in a SQL-SERVER 7.0 with a EJB CMP but
I don't know which java type I have to use in the bean to map this field.
 I've tried with a java.util.Date type but I get the following error when i try to change the value
of the data field:
 
javax.ejb.EJBException: Error saving state: [Microsoft] [ODBC SQL Server Driver] Datatime field overflow
    at Persona_EntityBeanWrapper0.saveState(Persona_EntityBeanWrapper0.java:3092)
    at Persona_EntityBeanWrapper0.setPer_fecha_nac(Persona_EntityBeanWrapper0.java:2964)
    at NewCmp.doGet(NewCmp.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at com.evermind.server.http.d1.si(JAX)
    at com.evermind.server.http.d1.forward(JAX)
    at com.evermind.server.http.ed.sp(JAX)
    at com.evermind.server.http.ed.so(JAX)
    at com.evermind.util.f.run(JAX)
 
I have the following type mapping in the database-schema definition for
sql-server:
 
   <type-mapping type="java.util.Date" name="datetime" />
 
but it still doesn't work. 
 
This is what I'm doing:
 
 .
 .
 .
 java.util.Date d = new java.util.Date(2004, 11, 27);
 
Context context = new InitialContext();
      
Object homeObject = context.lookup("java:comp/env/Table1");
Table1Home home = (Table1Home)PortableRemoteObject.narrow(homeObject, Table1Home.class);
      
Table1 e = home.findByPrimaryKey("1234"); --> this works
 e.setA(d);       ----> this is the line where i get the error.
 
The code for setA is the following:
 
public void setA(java.util.Date newValue) {
    this.a = newValue;
   }
 
 
Thanks.
 

Reply via email to