polymorphic mapping (brutos mvc)

13
Polymorphic mapping Polymorphic mapping Brutos MVC Brutos MVC www.brutosframework.com.b www.brutosframework.com.b r r

Upload: afonsobrandao

Post on 17-Aug-2015

54 views

Category:

Technology


0 download

TRANSCRIPT

Polymorphic mappingPolymorphic mapping

Brutos MVCBrutos MVC

www.brutosframework.com.brwww.brutosframework.com.br

Polymorphic mappingPolymorphic mappingThe polymorphic mapping, introduced in release 2.0, is a solution of such mapping requirement as an instance of entity needs to be associated with one of multiple possible entities. This can be implemented with the annotation @Any. This mapping type requires that besides the mapping of beans, is informed the meta-bean, a variable that contains the identifier associated with the bean.One such real life example is sale scenario, where a touristic operator seller different services. The requirement is to design sales system to manage the data of services being sold.The system allow registry one air or hosting service per sale transaction.

Polymorphic mappingPolymorphic mapping

In this case, during each sale transaction, one service will be sold. This service can either be air or hosting.

Polymorphic mappingPolymorphic mappingSaleTransaction.java

The annotation @Any indicates that service property may receive the instances of AirService, if parameter entity.service.serviceType is equals to "air", or HostingServices, if parameter entity.service.serviceType is equals to "hosting".The annotation @Transient indicates that property is ignored by the framework.

Polymorphic mappingPolymorphic mappingService.java

Polymorphic mappingPolymorphic mappingAbstractService.java

Polymorphic mappingPolymorphic mappingAirService.java

Polymorphic mappingPolymorphic mappingHostingService.java

Polymorphic mappingPolymorphic mappingSalesController.java

Polymorphic mappingPolymorphic mappingView (part of serviceType mapping)

Polymorphic mappingPolymorphic mappingView (part of airService mapping)

Polymorphic mappingPolymorphic mappingView (part of hostingService mapping)

ReferencesReferences

http://www.brutosframework.com.br/http://www.brutosframework.com.br/ http://www.amazon.com.br/Brutos-Framewhttp://www.amazon.com.br/Brutos-Framew

ork-framework-para-aplicaork-framework-para-aplica%C3%A7%C3%B5es-%C3%A7%C3%B5es-ebookebook//dpdp/B00VD3JDOM//B00VD3JDOM/refref=sr_1_1?=sr_1_1?ieie=UTF8&=UTF8&qidqid=1435879104&=1435879104&srsr=8-1&=8-1&keywordskeywords==javajava++mvcmvc

httpshttps://://enen..wikipedia.orgwikipedia.org//wikiwiki//Brutos_FrameworkBrutos_Framework