[
https://issues.apache.org/jira/browse/TOMEE-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714992#comment-16714992
]
Thomas Lien commented on TOMEE-2234:
------------------------------------
I should also mention that invoking a finder method on an EJB2 BMP that returns
257 or more entities will corrupt finder methods permanantly (it will continue
to return incorrect entity types on finders in new transactions) so this is a
very serious bug. The only way to fix it is to restart TomEE.
> BMP finder returning more than 256 entities
> -------------------------------------------
>
> Key: TOMEE-2234
> URL: https://issues.apache.org/jira/browse/TOMEE-2234
> Project: TomEE
> Issue Type: Bug
> Components: TomEE Core Server
> Affects Versions: 1.7.3, 7.0.5
> Reporter: Thomas Lien
> Priority: Major
> Attachments: sourcecode.zip, ztest.ear.zip
>
>
> Running into a situation where calling an EJB2 BMP finder method that returns
> more than 256 entities causes subsequent finder calls in the same sessionbean
> transaction to fail.
>
> {code:java}
> BigFinderHome bigFinderHome = (BigFinderHome)lookup("BigFinderHome");
> LittleFinderHome littleFinderHome =
> (LittleFinderHome)lookup("LittleFinderHome");
> for (int i = 1; i < 300; ++i) {
> // this is a test finder that returns "i" number of entities
> // once this returns more than 256 it causes the littleFinderHome.findAll
> // to return BigFinder entities instead of the LittleFinder entities!
> bigFinderHome.findN(i);
> Collection littleList = littleFinderHome.findAll();
> for (Object obj: littleList) {
> StringBuilder msg = new StringBuilder();
> if (!(obj instanceof LittleFinder)) {
> msg.append("Failed with " + i + " records. LittleFinder Remote is
> actually " + obj.getClass().getName() + " Implemented interfaces " +
> Arrays.toString(obj.getClass().getInterfaces()));
> if (obj instanceof EJBObject) {
> Object pk = ((EJBObject)obj).getPrimaryKey();
> msg.append(" Primary key value is " + pk);
> }
> throw new EJBException(msg.toString());
> }
> }
> {code}
>
> I can replicate this 100% of the time by deploying the attached ztest.ear
> application and running the FinderTestBean.main function (same as the above
> code). I have tried this on TomEE versions 1.7.3 and 7.0.5 and they both have
> the error.
> The error output of my test is as follows
> 09-07 12:25:13 [SEVERE] EjbTransactionUtil.handleSystemException: Failed with
> 257 records. LittleFinder Remote is actually com.sun.proxy.$Proxy142
> Implemented interfaces [interface ztest.BigFinder, interface
> java.io.Serializable, interface org.apache.openejb.core.ivm.IntraVmProxy]
> Primary key value is 1
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)