Hitoshi Ozawa:
Yeah, I wish there was a "non-db" attribute of some kind for the entities. That way SB could be an actual "service builder" rather than just a "data service builder".
It's a SOA design principle. The owner of the entity is the one who governs the services. If a facade service can be build by somebody else and the entity definition is changed by the owner, the service may not work properly. A workable option is to support multiple version of the interface so the old version of the interface can still be used, but the current Service Builder doesn't support multiple interface versioning.
I get the SOA design principles, and I'm not arguing about versioning or anything like that...
I'd like to be able to define entities that are not backed by a database table yet fit nicely into the SB pattern. I could put these entities into a service.xml file, build the services (local, remote, or both), and then consume the services/entities in other Liferay plugins the same way that DB entities are...
Right now you can define an empty entity, but methods that you add to the XxxLocalServiceImpl class are limited to returning primitives (or their Object counterparts), collections of primitives (or object counterparts), or a SB-defined entity (either from your service.xml file or one of the Liferay entities). You cannot define your own interface/implementation and pass that back because the CLP stuff generated by SB doesn't know anything about your own classes.
However, if you could define a non-DB entity, you could specify the entity in service.xml, add whatever methods you want in XxxLocalServiceImpl and build services to share this with other plugins because SB will generate the correct CLP stuff for you.
Using an in-memory or lazy database is a hack solution which allows you to do this, but certainly if SB supported it natively this hack wouldn't be necessary (although there would need to be a bunch of new templates/classes added at the SB foundations to support it).
SOA is definitely the way to go, but right now SB is limited to database services. What I'm talking about is opening SB up to non-database services too.
Por favor, faça login para denunciar.