In other words, if you really want to store an integer in a string
field, initialize id = "1", so that JBoss can test your PK and determine
whether it properly implements equals and hashCode. 

Why are you keeping an integer in a string?

danch

"Bordet, Simone" wrote:
> 
> What exactly you don't understand ?
> id is null when the PK is created using the default constructor, and
> parseInt fails.
> 
> BTW, equals is wrong, unless you want to test object identity (which is
> normally not the case of PKs).
> 
> And why using a String to hold an integer pk ?
> 
> HTH,
> 
> Simon
> 
> > -----Original Message-----
> > From: Ricky [mailto:[EMAIL PROTECTED]]
> > Sent: giovedi 8 marzo 2001 10:51
> > To: JBoss-User
> > Subject: [jBoss-User] What is this primary key error message in Jboss
> >
> >
> >
> >   Hi all  I am using Linux6.1 and jBoss-FINAL_2.0. Anybody
> > have any good
> > ideas what is the problems ??
> >
> >   When I have deployed ejb to jboss container , i have  the
> > error below
> > :
> >
> >   The code in my primary key is :
> >
> >   public String id;
> >
> >   public GeneratePK(){
> >   }
> >
> >   public GeneratePK(String key) {
> >    this.id = key;
> >   }
> >
> >   public int hashCode(){
> >    return Integer.parseInt(this.id);
> >   }
> >
> >   public boolean equals(Object refs){
> >     if( refs instanceof GeneratePK ){
> >        return ( this.id == ((GeneratePK)refs).id);
> >     }
> >    return false;
> >   }
> >
> >
> >   Error in jboss container :
> >
> >   [Verifier] java.lang.NumberFormatException: null
> > [Verifier]    at java.lang.Integer.parseInt(Integer.java:373)
> > [Verifier]    at java.lang.Integer.parseInt(Integer.java:454)
> > [Verifier]    at generatepk.GeneratePK.hashCode(GeneratePK.java:26)
> > [Verifier]    at
> > org.jboss.verifier.strategy.EJBVerifier11.verifyPrimaryKey(EJB
> > Verifier11.java:1486)
> > [Verifier]    at
> > org.jboss.verifier.strategy.EJBVerifier11.checkEntity(EJBVerif
> > ier11.java:122)
> > [Verifier]    at
> > org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:130)
> > [Verifier]    at
> > org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:376)
> > [Verifier]    at
> > org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:272)
> > [Verifier]    at java.lang.reflect.Method.invoke(Native Method)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1628)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1523)
> > [Verifier]    at
> > org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeploye
> > r.java:645)
> > [Verifier]    at
> > org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:137)
> > [Verifier]    at java.lang.reflect.Method.invoke(Native Method)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1628)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1523)
> > [Verifier]    at
> > org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:332)
> > [Verifier]    at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:268)
> > [Verifier]    at
> > org.jboss.ejb.AutoDeployer.startService(AutoDeployer.java:311)
> > [Verifier]    at
> > org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:92)
> > [Verifier]    at java.lang.reflect.Method.invoke(Native Method)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1628)
> > [Verifier]    at
> > com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.
> > java:1523)
> > [Verifier]    at
> > org.jboss.dependencies.DependencyManager.startMBean(Dependency
> > Manager.java:284)
> > [Verifier]    at
> > org.jboss.dependencies.DependencyManager.loadService(Dependenc
> > yManager.java:261)
> > [Verifier]    at
> > org.jboss.dependencies.DependencyManager.processService(Depend
> > encyManager.java:243)
> > [Verifier]    at
> > org.jboss.dependencies.DependencyManager.startMBeans(Dependenc
> > yManager.java:117)
> > [Verifier]    at org.jboss.Main.<init>(Main.java:162)
> > [Verifier]    at org.jboss.Main$1.run(Main.java:87)
> > [Verifier]    at java.security.AccessController.doPrivileged(Native
> > Method)
> > [Verifier]    at org.jboss.Main.main(Main.java:83)
> > [Container factory] Deploying PKGenerate
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> >
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]

Reply via email to