Strange problem when using Transaction


#1

Currently I use lucee 5.2.4.37 with MSSQL as database. My application has setting this.ormEnabled = true

I have a simple cfc file (test.cfc) like this:

component
  persistent="true"
  output="false"
{
   property name="thename" type="string" 
}

after that in my cfm file I do call like this:

myTest = new test();
wequery = new Query();
sql = "INSERT INTO TData
	(data)
	VALUES
	('Hello')";

wequery.setSQL(sql);

transaction{
	myTest.setthename('name');
	wequery.execute();
}

this will return error:

this feature is not supported
The error occurred on line 110 in file /org/lucee/cfml/Base.cfc.

If I remove the transaction, then this is working fine. Or If the code like this:

transaction{
	wequery.execute();
}

this is work fine too. Anyone has ever get this problem? FYI, if I set this.ormEnabled = false, then no error. So it seems lucee still have bug with ORM things ?

Thanks

Andri


#2

I think you have mixing concepts.

If you want to use ORM, then you not need to do sql to insert new data, you should instead use the orm functions:

myTest = EntityNew('test');
myTest.name = 'name';
EntitySave(myTest);

if you want to modify the record, use a transaction:

transaction { 
  myTest.name = 'name2';
}

Cheers


#3

Yes, I know. I just want to show if there is bugs in lucee, when we use transaction and we have an object with setter variable.

<cfset obj = new log();
< cftransaction>
   <cfset obj.setLogInfo(‘log’) />

<cfquery name="qTest">
	Select 1 from Table
<cfquery>

< /cftransaction>

in log.cfc

component
persistent=“true”
output=“false”
{
property name=“LogInfo” type=“string”
}

this simple code will error in lucee