Thanks Kevin,
I tried setting the QuerySQLCache to false but that didn't seem to fix the
issue. I am still seeing those exceptions.
Does it have to do anything with class loaders or maybe something with the
way I currently have setup my parent-child relations
As mentioned before it works fine if there is just one record in my parent
table, if more than one then I get the exception.
Here are my parent & child class
//Parent super class
@MappedSuperclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
@Access(AccessType.FIELD)
public abstract class TransactionQueue {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="TransactionID")
private int transactionId;
.. other field omitted
}
//Parent class
@Entity
@Access(AccessType.FIELD)
public class OrderTransactionQueue extends TransactionQueue implements
Serializable {
private static final long serialVersionUID = 1L;
@OneToMany(mappedBy="orderTransactionQueue", fetch=FetchType.EAGER,
cascade=CascadeType.ALL,targetEntity=OrderTransaction.class)
private List<OrderTransaction> orderTransactions;
}
//Child class
@Entity
@IdClass(OrderTransactionPK.class)
public class OrderTransaction implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="OrderNum")
private int orderNum;
//bi-directional many-to-one association to OrderTransactionQueue
@ManyToOne
@JoinColumn(name="TransactionID")
@Id
private OrderTransactionQueue orderTransactionQueue;
}
//Child Id class
public class OrderTransactionPK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
private int orderNum;
private int orderTransactionQueue;
}
Please, let me know if you need more information.
Thanks,
Javid
On Thu, Jun 13, 2013 at 2:36 PM, Kevin Sutter [via OpenJPA] <
[email protected]> wrote:
> Since you are using WebSphere, I would also suggest opening a PMR for this
> problem through the normal IBM support channels. If this question does
> turn into something "real" and requires an iFix, then you'll need the PMR
> and APAR to get the fix delivered anyway...
>
> Since your query works some of the times and not others, my first guess is
> that there might be an issue with the SQL cache. You can quickly verify
> this by turning off the SQL cache via this property. If that works for
> you, at least you have a workaround until a real fix can be determined.
>
> <property name="openjpa.jdbc.QuerySQLCache" value="false">
>
> There are other options with this Cache that might help you out. For
> example, if turning off the Cache completely gets you around the problem,
> then you could just turn it off for a specific query. Details can be
> found
> in the documentation [1].
>
> Hope this helps get you started.
> Kevin
>
> [1]
>
> http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_cache_querysql
>
>
> On Thu, Jun 13, 2013 at 1:12 PM, javid.alimohideen <
> [hidden email] <http://user/SendEmail.jtp?type=node&node=7584159&i=0>>
> wrote:
>
> > Hi,
> > I have web application running on Websphere v8.5, that uses a JPA
> project
> > configured as utility project. The application suddenly started throwing
> > ClassCastException when performing select query. I have pasted the
> > exception
> > stack trace. The weird things is it works sometime and at times I get
> this
> > exception. Also, if the DB tables have just one record then everything
> > works
> > fine, if there are more than 1 record then I see this exception
> >
> > The entities have a OneToMany and ManyToOne relationships defined.
> >
> > Caused by: java.lang.ClassCastException: org.apache.openjpa.util.IntId
> > incompatible with com.jpa.dom.transactionqueue.BlockTransactionQueue
> > at
> >
> >
> com.jpa.dom.transactionqueue.BlockCompleteTransaction.pcReplaceField(BlockCompleteTransaction.java)
>
> > at
> >
> >
> org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3174)
>
> > at
> >
> >
> org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(StateManagerImpl.java:2602)
>
> > at
> >
> >
> org.apache.openjpa.kernel.StateManagerImpl.storeObject(StateManagerImpl.java:2592)
>
> > at
> >
> >
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setMappedBy(JDBCStoreManager.java:476)
>
> > at
> >
> >
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:402)
>
> > at
> >
> >
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:304)
>
> > at
> >
> >
> com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:149)
>
> > at
> >
> >
> org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
>
> > at
> >
> >
> org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
>
> > at
> > org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1036)
> > at
> org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:994)
> >
> > I can post any additional detail if needed. please, let me know.
> >
> > Thanks
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openjpa.208410.n2.nabble.com/ClassCastException-org-apache-openjpa-util-IntId-incompatible-tp7584145.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://openjpa.208410.n2.nabble.com/ClassCastException-org-apache-openjpa-util-IntId-incompatible-tp7584145p7584159.html
> To unsubscribe from ClassCastException - org.apache.openjpa.util.IntId
> incompatible, click
> here<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7584145&code=amF2aWQuYWxpbW9oaWRlZW5AZ21haWwuY29tfDc1ODQxNDV8LTQ3NzA1MDU0MA==>
> .
> NAML<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://openjpa.208410.n2.nabble.com/ClassCastException-org-apache-openjpa-util-IntId-incompatible-tp7584145p7584183.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.