- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Problem migrating from v1.1 to v2.5
Joined: 23-Oct-2007
Hi!
I've just upgraded LLBLGen from v1.1 to v2.5. I'm using the Adapter-concept under .NET 2. The following components are used SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll version 2.5.7.1005 SD.LLBLGen.Pro.DQE.Oracle10g.NET20.dll version 2.5.7.820 Oracle.DataAccess version 2.102.2.20 .Net Framework version 2.0
After some work I finally got my application to compile. But... During runtime I immediately run into problems.
First at a call to a stored procedure I get a strange NullReferenceException in the generated code (DataAccessAdapter) My Code============================== public DataTable ReadActiveAlarms() { DataTable dt; try { dt = RetrievalProcedures.GetActiveAlarms().Tables[0]; } catch (Exception ex) { : : LLBLGen Code======================= public static DataSet GetActiveAlarms() { using(DataAccessAdapter adapter = new DataAccessAdapter()) { return GetActiveAlarms( adapter); } } LLBLGen Code======================= public static DataSet GetActiveAlarms(DataAccessAdapter adapter) { OracleRefCursor pRecordset = null; OracleParameter[] parameters = new OracleParameter[1]; parameters[0] = new OracleParameter("P_RECORDSET", OracleDbType.RefCursor, 0, ParameterDirection.Output, true, 0, 0, "", DataRowVersion.Current, pRecordset); DataSet toReturn = new DataSet("GetActiveAlarms"); bool hasSucceeded = adapter.CallRetrievalStoredProcedure ("FOCS.GETACTIVEALARMS", parameters, toReturn);
for(int i=0;i<1;i++)
{
if(parameters[i] != null)
{
parameters[i].Dispose();
}
}
return toReturn;
}
LLBLGen Code=======================
public virtual bool CallRetrievalStoredProcedure
(
string storedProcedureToCall,
OracleParameter[] parameters,
DataSet dataSetToFill
)
{
OracleCommand command = new OracleCommand
(CreateCorrectStoredProcedureName(storedProcedureToCall));
command.Connection =
(OracleConnection)base.GetActiveConnection();
if(base.IsTransactionInProgress)
{
((IDbCommand)command).Transaction =
(OracleTransaction)base.PhysicalTransaction;
}
command.CommandType = CommandType.StoredProcedure;
command.CommandTimeout = base.CommandTimeOut;
//--> Exception:
//{"Object reference not set to an instance of an object."}
// System.Exception {System.NullReferenceException}
for(int i=0;i<parameters.Length;i++)
{
command.Parameters.Add(parameters[i]);
}
:
:
The intellisense in Visual studio shows that base.CommandTimeOut=30 and command.CommandTimeout=0. What is null?
StackTrace at System.String.EqualsHelper(String strA, String strB) at System.String.Equals(String a, String b) at System.String.op_Inequality(String a, String b) at Oracle.DataAccess.Client.OracleCommand.set_CommandText(String value) at FOCS.DatabaseSpecific.DataAccessAdapter.CallRetrievalStoredProcedure(String storedProcedureToCall, OracleParameter[] parameters, DataSet dataSetToFill) in C:\\project\\FOCS\\SERVER\\FOCS\\DatabaseSpecific\\DataAccessAdapter.cs:line 209 at FOCS.DatabaseSpecific.RetrievalProcedures.GetActiveAlarms(DataAccessAdapter adapter) in C:\\project\\FOCS\\SERVER\\FOCS\\DatabaseSpecific\\RetrievalProcedures.cs:line 57 at FOCS.DatabaseSpecific.RetrievalProcedures.GetActiveAlarms() in C:\\project\\FOCS\\SERVER\\FOCS\\DatabaseSpecific\\RetrievalProcedures.cs:line 40 at FOCSBL.DBAccess.CAEDbAdapter.ReadActiveAlarms() in C:\\project\\FOCS\\SERVER\\FOCSBL\\DBAccess\\CAEDbAdapter.cs:line 54
================================= After removing the call to the stored procedure I ran into another problem. The code below gives an exception. As I can see it the code is exactly as the example in the manual.
string category = "StockData";
adapter = new DataAccessAdapter();
// Get requested category
StockCategoryEntity stockCategory = new StockCategoryEntity();
stockCategory.Name = category;
adapter.FetchEntityUsingUniqueConstraint(
stockCategory,
stockCategory.ConstructFilterForUCName());
{"An exception was caught during the execution of a retrieval query: ORA-01722: invalid number. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."}
InnerException {"ORA-01722: invalid number"} System.Exception {Oracle.DataAccess.Client.OracleException}
StackTrace at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFields2 fieldsToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfos, IRelationPredicateBucket filter) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingUniqueConstraint(IEntity2 entityToFetch, IPredicateExpression uniqueConstraintFilter, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingUniqueConstraint(IEntity2 entityToFetch, IPredicateExpression uniqueConstraintFilter) at FOCSBL.Tracking.CTrackingDBAccess.GetStockProperty(String category, Type enumType) in C:\\project\\FOCS\\SERVER\\FOCSBL\\Tracking\\CTrackingDBAccess.cs:line 119
=================================
Does anybody have an idea about what might be wrong?
/Lary
Joined: 23-Oct-2007
The generated code seem to use another version of the Oracle.DataAccess component than the one refrenced in the generated project. (xxxDBSpecific).
The problem was that I had i version redirection in my App.Config that I did'nt know.
/Solved!
Issue # 1:
The intellisense in Visual studio shows that base.CommandTimeOut=30 and command.CommandTimeout=0. What is null?
StackTrace at System.String.EqualsHelper(String strA, String strB) at System.String.Equals(String a, String b) at System.String.op_Inequality(String a, String b) at Oracle.DataAccess.Client.OracleCommand.set_CommandText(String value)
The stack trace tells that the exception is generated in the OracleCommand.set_CommandText, it has nothing to do with the CommandTimeout. Would you please debug and see if there is text passed in from the CreateCorrectStoredProcedureName() method to the constructor of the OracleCommand?
OracleCommand command = new OracleCommand
(CreateCorrectStoredProcedureName(storedProcedureToCall));
Issue #2:
{"An exception was caught during the execution of a retrieval query: ORA-01722: invalid number. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."}
InnerException {"ORA-01722: invalid number"} System.Exception {Oracle.DataAccess.Client.OracleException}
Please catch the generated query from the output trace and manually run it against the database to see what's going wrong. (ref: LLBLGen Pro manual "Using the generated code -> Troubleshooting and debugging")