[jboss-cvs] JBossAS SVN: r67397 - in branches/Branch_4_4: server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 23 06:48:18 EST 2007
Author: alex.loubyansky at jboss.com
Date: 2007-11-23 06:48:18 -0500 (Fri, 23 Nov 2007)
New Revision: 67397
Modified:
branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java
branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDynamicQLQuery.java
branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCEJBQLCompiler.java
branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java
branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCSelectorBridge.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/Facade.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/FacadeSessionBean.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/GetSetObjectParameter.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOB.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBBean.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBHome.java
branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBUnitTestCase.java
branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/ejb-jar.xml
branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/jbosscmp-jdbc.xml
Log:
JBAS-4975
Modified: branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java
===================================================================
--- branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.ejb.plugins.cmp.jdbc;
import java.lang.reflect.Method;
@@ -57,7 +57,7 @@
* Provides the handleResult() implementation that these all need.
*
* @author <a href="mailto:dain at daingroup.com">Dain Sundstrom</a>
- * @author <a href="mailto:rickard.oberg at telkel.com">Rickard �berg</a>
+ * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Oberg</a>
* @author <a href="mailto:marc.fleury at telkel.com">Marc Fleury</a>
* @author <a href="mailto:shevlandj at kpi.com.au">Joe Shevland</a>
* @author <a href="mailto:justin at j-m-f.demon.co.uk">Justin Forder</a>
@@ -353,7 +353,9 @@
protected void setEagerLoadGroup(String eagerLoadGroup)
{
this.eagerLoadGroup = eagerLoadGroup;
- this.eagerLoadMask = selectEntity.getLoadGroupMask(eagerLoadGroup);
+ boolean[] originalMask = selectEntity.getLoadGroupMask(eagerLoadGroup);
+ this.eagerLoadMask = new boolean[originalMask.length];
+ System.arraycopy(originalMask, 0, eagerLoadMask, 0, eagerLoadMask.length);
}
protected String getEagerLoadGroup()
Modified: branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDynamicQLQuery.java
===================================================================
--- branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDynamicQLQuery.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDynamicQLQuery.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.ejb.plugins.cmp.jdbc;
import java.lang.reflect.Method;
@@ -141,6 +141,7 @@
if(selectEntity != null && readahead.isOnFind())
{
mask = selectEntity.getLoadGroupMask(readahead.getEagerLoadGroup());
+ boolean modifiedMask = false;
leftJoinCMRList = compiler.getLeftJoinCMRList();
// exclude non-searchable columns if distinct is used
@@ -151,6 +152,13 @@
{
if(mask[i] && !tableFields[i].getJDBCType().isSearchable())
{
+ if(!modifiedMask)
+ {
+ boolean[] original = mask;
+ mask = new boolean[original.length];
+ System.arraycopy(original, 0, mask, 0, mask.length);
+ modifiedMask = true;
+ }
mask[i] = false;
}
}
@@ -166,8 +174,9 @@
setParameterList(compiler.getInputParameters());
EntityContainer con = ((JDBCStoreManager)compiler.getStoreManager()).getContainer();
- factory = metadata.isResultTypeMappingLocal() ? (GenericEntityObjectFactory)con.getLocalProxyFactory() : con.getProxyFactory();
-
+ factory = metadata.isResultTypeMappingLocal() && con.getLocalHomeClass() != null ?
+ con.getLocalProxyFactory() : con.getProxyFactory();
+
return execute(
compiler.getSQL(),
parameters,
Modified: branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCEJBQLCompiler.java
===================================================================
--- branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCEJBQLCompiler.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCEJBQLCompiler.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.ejb.plugins.cmp.jdbc;
import java.io.StringReader;
@@ -1041,7 +1041,7 @@
selectManager = (JDBCStoreManager) selectEntity.getManager();
selectObject = selectEntity;
setTypeFactory(selectManager.getJDBCTypeFactory());
- selectEntity(path, buf);
+ selectEntity(path, node.distinct, buf);
}
}
else
@@ -1563,7 +1563,7 @@
{
countCompositePk = true;
forceDistinct = node.distinct.length() > 0;
- selectEntity(cntPath, buf);
+ selectEntity(cntPath, forceDistinct, buf);
return buf;
}
else
@@ -1642,7 +1642,8 @@
{
case EJBQLTypes.ENTITY_TYPE:
case EJBQLTypes.VALUE_CLASS_TYPE:
- if(cmpField.getJDBCType().hasMapper())
+ if(cmpField.getJDBCType().hasMapper() ||
+ cmpField.getJDBCType().getParameterSetter() != null)
{
break;
}
@@ -1862,7 +1863,7 @@
return selected;
}
- private void selectEntity(ASTPath path, StringBuffer buf)
+ private void selectEntity(ASTPath path, boolean distinct, StringBuffer buf)
{
JDBCEntityBridge selectEntity = (JDBCEntityBridge) path.getEntity();
@@ -1878,7 +1879,10 @@
{
String eagerLoadGroupName = readAhead.getEagerLoadGroup();
boolean[] loadGroupMask = selectEntity.getLoadGroupMask(eagerLoadGroupName);
- SQLUtil.appendColumnNamesClause(selectEntity.getTableFields(), loadGroupMask, selectAlias, columnNamesClause);
+ if(distinct)
+ SQLUtil.appendSearchableColumnNamesClause(selectEntity.getTableFields(), loadGroupMask, selectAlias, columnNamesClause);
+ else
+ SQLUtil.appendColumnNamesClause(selectEntity.getTableFields(), loadGroupMask, selectAlias, columnNamesClause);
try
{
Modified: branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java
===================================================================
--- branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.ejb.plugins.cmp.jdbc;
import java.sql.Connection;
@@ -432,6 +432,26 @@
return buf;
}
+ public static StringBuffer appendSearchableColumnNamesClause(JDBCFieldBridge[] fields,
+ boolean[] mask,
+ String identifier,
+ StringBuffer buf)
+ {
+ for(int i = 0; i < fields.length; ++i)
+ {
+ if(mask[i])
+ {
+ JDBCType type = getJDBCType(fields[i]);
+ if(type != null && type.isSearchable())
+ {
+ buf.append(COMMA);
+ getColumnNamesClause(type, identifier, buf);
+ }
+ }
+ }
+ return buf;
+ }
+
/**
* Returns ', columnName0 [, columnName1 [AND columnName2 [...]]]'
*/
Modified: branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCSelectorBridge.java
===================================================================
--- branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCSelectorBridge.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCSelectorBridge.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.ejb.plugins.cmp.jdbc.bridge;
import java.lang.reflect.Method;
@@ -107,9 +107,17 @@
try
{
JDBCQueryCommand query = manager.getQueryManager().getQueryCommand(method);
- GenericEntityObjectFactory factory = (queryMetaData.isResultTypeMappingLocal() ?
- (GenericEntityObjectFactory)query.getSelectManager().getContainer().getLocalProxyFactory() :
- query.getSelectManager().getContainer().getProxyFactory());
+ EntityContainer selectedContainer = query.getSelectManager().getContainer();
+ GenericEntityObjectFactory factory;
+ if(queryMetaData.isResultTypeMappingLocal() && selectedContainer.getLocalHomeClass() != null)
+ {
+ factory = selectedContainer.getLocalProxyFactory();
+ }
+ else
+ {
+ factory = selectedContainer.getProxyFactory();
+ }
+
retVal = query.execute(method, args, null, factory);
}
catch(FinderException e)
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/Facade.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/Facade.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/Facade.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
import java.rmi.RemoteException;
@@ -71,4 +71,6 @@
throws Exception, RemoteException;
public void modifyStateFactoryValueHolderValue(Integer id, String value)
throws Exception, RemoteException;
+ boolean executeDynamicQuery(String query, Object[] params)
+ throws Exception, RemoteException;
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/FacadeSessionBean.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/FacadeSessionBean.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/FacadeSessionBean.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
@@ -26,6 +26,7 @@
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
+import javax.ejb.FinderException;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.Set;
@@ -150,6 +151,22 @@
holder.setDirty(true);
}
+ public boolean executeDynamicQuery(String query, Object[] params)
+ throws Exception
+ {
+ try
+ {
+ getLOBHome().select(query, params);
+ return true;
+ }
+ catch(FinderException e)
+ {
+ // it used to catch the exception
+ // since the field mask and query results were inconsistent
+ return false;
+ }
+ }
+
// SessionBean implementation
/**
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/GetSetObjectParameter.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/GetSetObjectParameter.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/GetSetObjectParameter.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
import java.sql.PreparedStatement;
@@ -43,7 +43,8 @@
public Object get(ResultSet rs, int index, Class destination, Logger log) throws SQLException
{
Object value = rs.getObject(index);
- log.debug("get: i=" + index + ", destination="+destination+", value=" + value);
+ if(log.isTraceEnabled())
+ log.trace("get: i=" + index + ", destination="+destination+", value=" + value);
Object result = value;
if(rs.wasNull())
{
@@ -69,7 +70,8 @@
public void set(PreparedStatement ps, int index, int jdbcType, Object value,
Logger log) throws SQLException
{
- log.debug("set: i=" + index + ", jdbcType="+jdbcType+", value=" + value);
+ if(log.isTraceEnabled())
+ log.trace("set: i=" + index + ", jdbcType="+jdbcType+", value=" + value);
if( value instanceof MarshalledValue )
{
MarshalledValue mv = (MarshalledValue) value;
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOB.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOB.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOB.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
import java.rmi.RemoteException;
@@ -98,4 +98,7 @@
ValueHolder getStateFactoryValueHolder() throws RemoteException;
void setStateFactoryValueHolder(ValueHolder valueHolder) throws RemoteException;
+
+ Integer getIntField() throws RemoteException;
+ void setIntField(Integer i) throws RemoteException;
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBBean.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBBean.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBBean.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,36 +1,38 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
+import javax.ejb.FinderException;
import java.util.Map;
import java.util.List;
import java.util.Set;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Collection;
/**
* Implementaton of a CMP2 entity bean that is intended to demonstrate the
@@ -107,6 +109,16 @@
public abstract ValueHolder getStateFactoryValueHolder();
public abstract void setStateFactoryValueHolder(ValueHolder valueHolder);
+ public abstract Integer getIntField();
+ public abstract void setIntField(Integer i);
+
+ public abstract Collection ejbSelectSelect(String query, Object[] params) throws FinderException;
+
+ public Collection ejbHomeSelect(String query, Object[] params) throws FinderException
+ {
+ return ejbSelectSelect(query, params);
+ }
+
// EntityBean implementation
@@ -119,6 +131,7 @@
setValueHolder(new ValueHolder(null));
setCleanGetValueHolder(new ValueHolder(null));
setStateFactoryValueHolder(new ValueHolder(null));
+ setIntField(new Integer(1));
return null;
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBHome.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBHome.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBHome.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.test.cmp2.lob;
import java.rmi.RemoteException;
@@ -50,4 +50,6 @@
public Collection findAll()
throws FinderException, RemoteException;
+ public java.util.Collection select(java.lang.String query , java.lang.Object[] params)
+ throws FinderException, RemoteException;
}
Modified: branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBUnitTestCase.java
===================================================================
--- branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBUnitTestCase.java 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/main/org/jboss/test/cmp2/lob/LOBUnitTestCase.java 2007-11-23 11:48:18 UTC (rev 67397)
@@ -1,8 +1,8 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
@@ -28,22 +28,21 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Properties;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.test.util.ejb.EJBTestCase;
import org.jboss.logging.Logger;
import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.ejb.EJBTestCase;
/**
* A test suite to check JBoss data mapping to/from Large Binary Objects (LOBs).
*
- * @see org.jboss.test.util.ejb.EJBTestCase
- *
* @version <tt>$Revision$</tt>
* @author <a href="mailto:steve at resolvesw.com">Steve Coy</a>.
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
@@ -98,14 +97,14 @@
suite.addTest(new LOBUnitTestCase("testValueHolder"));
suite.addTest(new LOBUnitTestCase("testCleanGetValueHolder"));
suite.addTest(new LOBUnitTestCase("testStateFactoryValueHolder"));
-
+ suite.addTest(new LOBUnitTestCase("testJBAS3717"));
+
return JBossTestCase.getDeploySetup(suite, "cmp2-lob.jar");
}
// Constructors --------------------------------------------------
public LOBUnitTestCase(String name)
- throws java.io.IOException
{
super(name);
}
@@ -293,7 +292,6 @@
public void testMapCMPField() throws Exception
{
- log.debug("testMapCMPField> start");
Facade facade = facadeHome.create();
Integer id = new Integer(111);
try
@@ -398,7 +396,6 @@
public void testValueHolder() throws Exception
{
- log.debug("testValueHolder> start");
Facade facade = facadeHome.create();
Integer id = new Integer(555);
try
@@ -471,7 +468,7 @@
* Lookup the LOB lobHome and cache it.
* Load the test data.
*/
- public void setUpEJB()
+ public void setUpEJB(Properties props)
throws Exception
{
log.debug("setupEJB");
@@ -492,13 +489,27 @@
}
}
+ public void testJBAS3717() throws Exception
+ {
+ Facade facade = facadeHome.create();
+ Integer id = new Integer(12);
+ try
+ {
+ facade.createLOB(id);
+ assertTrue(facade.executeDynamicQuery("select distinct object(o) from lob o", null));
+ }
+ finally
+ {
+ try { facade.removeLOB(id); } catch(Exception e) {}
+ }
+ }
+
/**
* Remove data references so that they can be garbage collected if needed.
*/
- public void tearDownEJB()
+ public void tearDownEJB(Properties props)
throws Exception
{
- log.debug("tearDownEJB");
}
// Protected -------------------------------------------------------
Modified: branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/ejb-jar.xml 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/ejb-jar.xml 2007-11-23 11:48:18 UTC (rev 67397)
@@ -44,7 +44,19 @@
<cmp-field><field-name>valueHolder</field-name></cmp-field>
<cmp-field><field-name>cleanGetValueHolder</field-name></cmp-field>
<cmp-field><field-name>stateFactoryValueHolder</field-name></cmp-field>
+ <cmp-field><field-name>intField</field-name></cmp-field>
<primkey-field>id</primkey-field>
+
+ <query>
+ <query-method>
+ <method-name>ejbSelectSelect</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.Object[]</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql><![CDATA[select object(o) from lob o]]></ejb-ql>
+ </query>
</entity>
</enterprise-beans>
Modified: branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/jbosscmp-jdbc.xml
===================================================================
--- branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/jbosscmp-jdbc.xml 2007-11-23 11:32:58 UTC (rev 67396)
+++ branches/Branch_4_4/testsuite/src/resources/cmp2/lob/META-INF/jbosscmp-jdbc.xml 2007-11-23 11:48:18 UTC (rev 67397)
@@ -87,6 +87,33 @@
<state-factory>
org.jboss.test.cmp2.lob.ValueHolderStateFactory</state-factory>
</cmp-field>
+
+ <!-- needs on-find for JBAS-3717 test -->
+ <query>
+ <query-method>
+ <method-name>findByPrimaryKey</method-name>
+ <method-params>
+ <method-param>java.lang.Integer</method-param>
+ </method-params>
+ </query-method>
+ <jboss-ql><![CDATA[select object(a) from lob a where a.id=?1]]></jboss-ql>
+ <read-ahead>
+ <strategy>on-find</strategy>
+ </read-ahead>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSelect</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.Object[]</method-param>
+ </method-params>
+ </query-method>
+ <dynamic-ql/>
+ <read-ahead>
+ <strategy>on-find</strategy>
+ </read-ahead>
+ </query>
</entity>
</enterprise-beans>
More information about the jboss-cvs-commits
mailing list