All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

Saving Entities

save

Save an entity using hibernate transactions or not. You can optionally flush the session also.

Returns

  • This function returns void

Arguments

Key
Type
Required
Default
Description

Examples

boolean

No

false

Do a flush after saving the entity, false by default since we use transactions

transactional

boolean

No

true

Wrap the save in a ColdFusion transaction

entity

any

Yes

---

The entity to save

forceInsert

boolean

No

false

Insert as new record whether it already exists or not

flush

var user = ormService.new("User");
populateModel(user);
ormService.save(user);

// Save with immediate flush
var user = ormService.new(entityName="User", lastName="Majano");
ormService.save(entity=user, flush=true);

saveAll

Saves an array of passed entities in specified order and transaction safe

Returns

  • This function returns void

Arguments

Key
Type
Required
Default
Description

Examples

boolean

No

false

transactional

boolean

No

true

Use ColdFusion transactions or not

entities

array

Yes

---

The array of entities to persist

forceInsert

boolean

No

false

flush

var user = ormService.new("User");
populateModel(user);
var user2 = ormService.new("User");
populateModel(user);

ormService.saveAll( [user1,user2] );