[JBoss-user] [EJB 3.0] - SerializationException due to NullPointerException in Unsafe

2006-04-08 Thread oliverchua
Hi, 

I have a method in my stateless session bean
public ListUnit getUnitListWithNone() {
  | ListUnit l = this.getUnitList();
  | Unit u = new Unit();
  | u.setUnitCode(new Long(Unit.NONE));
  | u.setUnitName(None);
  | l.add(0, u);
  | return l;
  | }

It works fine when I call it from my unit test remotely.
Now, I'm integrating it with struts, but ejb is also called remotely, so the 
behavior should be the same. 
However, I'm getting an exception... SerializationException

Anybody have an idea?

Below is the stack trace of the problem.

initial error:
08:56:57,675 INFO  [STDOUT] 08:56:57,675 INFO  [MenuAction] getServletPath: /pag
  | es/employee/employee/SearchEmployee.jsp
  | 08:56:59,207 WARN  [RequestProcessor] Unhandled Exception thrown: class 
java.lan
  | g.reflect.UndeclaredThrowableException
  | 08:56:59,207 ERROR [[action]] Servlet.service() for servlet action threw 
excepti
  | on
  | java.lang.reflect.UndeclaredThrowableException
  | at $Proxy313.getUnitListWithNone(Unknown Source)
  | at 
com.tougher.intranet.struts.employee.unit.UnitAction.search(UnitActio
  | n.java:93)
  | at 
com.tougher.intranet.struts.employee.unit.UnitAction.unspecified(Unit
  | Action.java:73)
  | at 
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchActio
  | n.java:256)

...

caused by:
Caused by: org.jboss.serial.exception.SerializationException
  | at 
org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWritePersister.java:134)
  | at 
org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDe
  | scriptionFromStreaming(ObjectDescriptorFactory.java:167)
  | at 
org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDe
  | scription(ObjectDescriptorFactory.java:55)
  | at 
org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.rea
  | dObject(DataContainer.java:657)
  | at 
org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossOb
  | jectInputStream.java:85)

...

caused by:
Caused by: java.lang.reflect.InvocationTargetException
  | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  | java:39)
  | at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  | sorImpl.java:25)
  | at java.lang.reflect.Method.invoke(Method.java:585)
  | at 
org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWrit
  | ePersister.java:124)
  | ... 39 more
  | Caused by: java.lang.NullPointerException
  | at 
org.jboss.serial.classmetamodel.UnsafeFieldsManager.setInt(UnsafeFiel
  | dsManager.java:82)
  | at 
org.jboss.serial.persister.RegularObjectPersister.defaultRead(Regular
  | ObjectPersister.java:172)
  | at 
org.jboss.serial.persister.RegularObjectPersister.readData(RegularObj
  | ectPersister.java:151)

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3936048#3936048

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3936048


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: ManyToOne - Problems managing relationships

2006-04-08 Thread oliverchua
Hi Colin,

If Child owns the relationship, should you be doing this:
child.setParent(parent)
instead of 
parent.addChild(child)?

From what I understand, if the Child is the mapped field(not the owner) the 
relationship will be ignored during saving to avoid duplicates.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3936049#3936049

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3936049


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: SerializationException due to NullPointerException in Un

2006-04-08 Thread oliverchua
Hello Clebert,

It turned out the reason for the error is because there are old hibernate jar 
files in my WEB-INF/lib folder.

I was migrating it to EJB 3.0 but forgot to delete those jar files. After I 
removed them, things were running as expected.

Thanks!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3936059#3936059

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3936059


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Bidirectional One to Many, Many To One

2006-04-05 Thread oliverchua
Hi,

I'm trying to follow the Hibernate Annotations Manual, under Collections
2.2.5.3.2.1. Bidirectional
Soldier and Troop classes...

I tried creating the classes
@Entity
  | public class Troop {
  | @Id
  | @GeneratedValue
  | private Long id;
  | private String name;
  | @OneToMany(mappedBy=troop)
  | private ListSoldier soldiers;
  | }
and
public class Soldier {
  | @Id
  | @GeneratedValue
  | private Long id;
  | private String name;
  | @ManyToOne
  | @JoinColumn(name=troopFK)
  | private Troop troop;
  | }

but I'm getting this error:
java.lang.ExceptionInInitializerError
  | at util.HibernateUtil.clinit(HibernateUtil.java:18)
  | at onetomany.OneToMany.testOneToManyDefault(OneToMany.java:16)
  | ...
  | Caused by: org.hibernate.AnnotationException: Collection of elements must 
not have mappedBy or association reference an unmapped entity: 
onetomanypermutations.Troop.soldiers
  | at 
org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:717)
...

I'm using Hibernate 3.2 and annotations 3.1beta9
Anyone with an idea what's wrong?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3935055#3935055

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3935055


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Bidirectional One to Many, Many To One

2006-04-05 Thread oliverchua
Wow, that was a stupid mistake... =D

Thanks!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3935061#3935061

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3935061


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Recursive Bidirectional entity

2006-04-03 Thread oliverchua
Emmanuel,

Thanks! that solved the problem

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3934311#3934311

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3934311


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Recursive Bidirectional entity

2006-03-30 Thread oliverchua
@Entity
  | public class Unit implements Serializable{
  | @Id @GeneratedValue
  | private Long unitCode;
  | private String unitName;
  | @ManyToOne @JoinColumn(name=superUnitCode)
  | private Unit superUnit;
  | @OneToMany(mappedBy=subUnits)
  | private SetUnit subUnits;
  | @Transient
  | private String superUnitCode;

Hi I have this entity class.
The OneToMany is bidirectional and recursive.
IT adds  
CONSTRAINT `FK284DA4E626B09B` FOREIGN KEY (`unitCode`) REFERENCES `unit` 
(`unitCode`)
that prevents any inserts to the table.

What should I do to remove the constraint?
Thanks in advance. 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3933897#3933897

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3933897


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Recursive Bidirectional entity

2006-03-30 Thread oliverchua
Hi Emmanuel, this is the script of the table that was created by hibernate...

CREATE TABLE  `intranetejb`.`unit` (
  |   `unitCode` bigint(20) NOT NULL auto_increment,
  |   `unitName` varchar(255) default NULL,
  |   `superUnitCode` bigint(20) default NULL,
  |   PRIMARY KEY  (`unitCode`),
  |   KEY `FK284DA4E626B09B` (`unitCode`),
  |   KEY `FK284DA41AB47516` (`superUnitCode`),
  |   CONSTRAINT `FK284DA41AB47516` FOREIGN KEY (`superUnitCode`) REFERENCES 
`unit` (`unitCode`),
  |   CONSTRAINT `FK284DA4E626B09B` FOREIGN KEY (`unitCode`) REFERENCES `unit` 
(`unitCode`)
  | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

When I am trying to insert a record in the database (not in EJB)
INSERT INTO `unit` (`unitCode`, `unitName`, `superUnitCode`) VALUES
  | (1,'My unit',NULL)
I get this error...
Cannot add or update a child row: a foreign key constraint fails 
(`intranetejb/unit`, CONSTRAINT `FK284DA4E626B09B` FOREIGN KEY (`unitCode`) 
REFERENCES `unit` (`unitCode`))

When I delete the constraint, I'm able to insert the record.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3933910#3933910

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3933910


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user