Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Please remember that you can use ANY method found in the Base ORM Service except that you will not pass an argument of entityName anymore as you have now bounded to that specific entity.
The virtual entity service is another support class that can help you create virtual service layers that are bounded to a specific ORM entity for convenience. This class inherits from our Base ORM Service and allows you to do everything the base class provides, except you do not need to specify to which entityName you are working with. You can also use this class as a base class and template out its methods to more concrete usages. The idea behind this virtual entity service layer is to allow you to have a very nice abstraction to all the CF ORM capabilities (hibernate) and promote best practices.
The WireBox injection DSL has an injection namespace called entityService that can be used to wire in a Virtual Entity Service. You will use this DSL in conjunction with the name of the entity to manage.
Once a virtual entity service is bounded it will be injected wherever you define it. Then just use it!
There are a few properties you can instantiate a base service with or set them afterwards that affect operation. Below you can see a nice chart for them:
So if I was to base off my services on top of this gem, I can do this:
You can also use the virtual entity service by directly instantiating the coldbox.system.orm.hibernate.VirtualEntityService, configuring it and using it:
Inject Content
Description
entityService:{entity}
Inject a VirtualEntityService object for usage as a service layer based off the name of the entity passed in.
Property | Type | Required | Default | Description |
| string | false |
| The name of the secondary cache region to use when doing queries via this base service |
| boolean | false | false | To enable the caching of queries used by this base service |
| boolean | false | true | Announce interception events on new() operations and save() operations: ORMPostNew, ORMPreSave, ORMPostSave |
| boolean | false | true | Enables ColdFusion safe transactions around all operations that either save, delete or update ORM entities |
| boolean | false | true | The bit that determines the default return value for list(), createCriteriaQuery() and executeQuery() as query or array of objects |
Let's say you are using the virtual service but you find that they do not complete your requirements, or you need some custom methods or change functionality. Then you will be building concrete services that inherit from the virtual entity service. This is the very purpose of these support classes as most of the time you will have custom requirements and your own style of coding. Below is a sample templated service layer:
You can refer to the ORM:BaseORMService methods without the entityName usage or refer to our API Docs.