My Entity class is below:
@Entity
@Table(name = "tb_product", catalog = "stream", uniqueConstraints = {})
public class TbProduct implements java.io.Serializable
{
// Fields
private Long id;
private TbProductType tbProductType;
private String code;
private String productName;
private Float weight;
private String partNumber;
// Constructors
/** default constructor */
public TbProduct()
{
}
/** minimal constructor */
public TbProduct(Long id, TbProductType tbProductType, String code,
String productName)
{
this.id = id;
this.tbProductType = tbProductType;
this.code = code;
this.productName = productName;
}
/** full constructor */
public TbProduct(Long id, TbProductType tbProductType, String code,
String productName, Float weight, String partNumber)
{
this.id = id;
this.tbProductType = tbProductType;
this.code = code;
this.productName = productName;
this.weight = weight;
this.partNumber = partNumber;
}
// Property accessors
@Id
@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true)
public Long getId()
{
return this.id;
}
public void setId(Long id)
{
this.id = id;
}
@ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY, optional=false)
@JoinColumn(name = "type_id", referencedColumnName = "id", unique = false, nullable = false, insertable = true, updatable = true)
public TbProductType getTbProductType()
{
return this.tbProductType;
}
public void setTbProductType(TbProductType tbProductType)
{
this.tbProductType = tbProductType;
}
@Column(name = "code", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
public String getCode()
{
return this.code;
}
public void setCode(String code)
{
this.code = code;
}
@Column(name = "product_name", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
public String getProductName()
{
return this.productName;
}
public void setProductName(String productName)
{
this.productName = productName;
}
@Column(name = "weight", unique = false, nullable = true, insertable = true, updatable = true, precision = 12, scale = 0)
public Float getWeight()
{
return this.weight;
}
public void setWeight(Float weight)
{
this.weight = weight;
}
@Column(name = "part_number", unique = false, nullable = true, insertable = true, updatable = true, length = 40)
public String getPartNumber()
{
return this.partNumber;
}
public void setPartNumber(String partNumber)
{
this.partNumber = partNumber;
}
}
@Entity
@Table(name = "tb_product_type", catalog = "stream", uniqueConstraints = {})
public class TbProductType implements java.io.Serializable
{
// Fields
private Long id;
private String typeName;
private String description;
private Set<TbProduct> tbProducts = new HashSet<TbProduct>(0);
// Constructors
/** default constructor */
public TbProductType()
{
}
/** minimal constructor */
public TbProductType(Long id)
{
this.id = id;
}
/** full constructor */
public TbProductType(Long id, String typeName, String description,
Set<TbProduct> tbProducts)
{
this.id = id;
this.typeName = typeName;
this.description = description;
this.tbProducts = tbProducts;
}
// Property accessors
@Id
@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true)
public Long getId()
{
return this.id;
}
public void setId(Long id)
{
this.id = id;
}
@Column(name = "type_name", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
public String getTypeName()
{
return this.typeName;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
@Column(name = "description", unique = false, nullable = true, insertable = true, updatable = true, length = 65535)
public String getDescription()
{
return this.description;
}
public void setDescription(String description)
{
this.description = description;
}
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "tbProductType")
public Set<TbProduct> getTbProducts()
{
return this.tbProducts;
}
public void setTbProducts(Set<TbProduct> tbProducts)
{
this.tbProducts = tbProducts;
}
}
@ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY, optional=false)
when I put FetchType.LAZY in entity class TbProduct, problem occurs ,but when i remove it , It's ok
This is the exception :
[#|2007-09-26T08:52:49.921+0800|SEVERE|sun-appserver9.1|javax.enterprise.resource.corba.ee.S1AS-ORB.rpc.transport|_ThreadID=17;_ThreadName=p: thread-pool-1; w: 5;0;4096;2000;6000;_RequestID=10f9148a-fee9-4267-acbf-ef5667c1d395;|"IOP00410227: (COMM_FAILURE) Unexpected exception when writing with a temporary selector: bytes written = 0, total bytes requested to write = 4,096, time spent waiting = 2,000 ms, max time to wait = {4}."
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 227 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.exceptionWhenWritingWithTemporarySelector(ORBUtilSystemException.java:3416)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.exceptionWhenWritingWithTemporarySelector(ORBUtilSystemException.java:3442)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.write(SocketOrChannelConnectionImpl.java:741)
at com.sun.corba.ee.impl.encoding.CDROutputObject.writeTo(CDROutputObject.java:196)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.sendWithoutLock(SocketOrChannelConnectionImpl.java:1126)
at com.sun.corba.ee.impl.encoding.BufferManagerWriteStream.sendFragment(BufferManagerWriteStream.java:149)
at com.sun.corba.ee.impl.encoding.BufferManagerWriteStream.overflow(BufferManagerWriteStream.java:92)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_2.grow(CDROutputStream_1_2.java:240)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_2.alignAndReserve(CDROutputStream_1_2.java:211)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.internalWriteOctetArray(CDROutputStream_1_0.java:573)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_octet_array(CDROutputStream_1_0.java:592)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_octet_array(CDROutputStream.java:302)
at com.sun.corba.ee.impl.corba.TypeCodeImpl.write_value(TypeCodeImpl.java:1814)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_TypeCode(CDROutputStream_1_0.java:632)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_any(CDROutputStream_1_0.java:612)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_any(CDROutputStream.java:390)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAny(Util.java:418)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.write_Array(ValueHandlerImpl.java:556)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:257)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeArray(CDROutputStream_1_0.java:745)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:923)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:756)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:818)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:232)
at com.sun.corba.ee.impl.io.OutputStreamHook.defaultWriteObject(OutputStreamHook.java:164)
at java.util.Vector.writeObject(Vector.java:1012)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:633)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:599)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:187)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:259)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:839)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:935)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:756)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:818)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:232)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:601)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:187)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:259)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:839)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:935)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:756)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:818)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:232)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:601)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:187)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:259)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:839)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:935)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:756)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:818)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:232)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:601)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:187)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:259)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:839)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:935)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:442)
at com.sun.corba.ee.impl.corba.TCUtility.marshalIn(TCUtility.java:162)
at com.sun.corba.ee.impl.corba.AnyImpl.write_value(AnyImpl.java:638)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_any(CDROutputStream_1_0.java:613)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_any(CDROutputStream.java:390)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAny(Util.java:418)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.write_Array(ValueHandlerImpl.java:556)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:257)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeArray(CDROutputStream_1_0.java:745)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:923)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:756)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:818)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:232)
at com.sun.corba.ee.impl.io.OutputStreamHook.defaultWriteObject(OutputStreamHook.java:164)
at java.util.Vector.writeObject(Vector.java:1012)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:633)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:599)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:187)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:259)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:241)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:179)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:839)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:935)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:949)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:690)
at com.sun.corba.ee.impl.encoding.CDROutputStream.write_value(CDROutputStream.java:451)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.write(DynamicMethodMarshallerImpl.java:376)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.writeResult(DynamicMethodMarshallerImpl.java:472)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:158)
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)
|#]
How can I resolve the problem , Is it a bug of Glassfish ?
[Message sent by forum member 'linuxsir' (linuxsir)]
http://forums.java.net/jive/thread.jspa?messageID=237051