Carlos Adolfo Ortiz Quirós:
Thank you very much for this tips. BTW, do you have some example portlets using Vaadin and any other view technology so I can learn a little more about how to build Portlets at hand. I am researching (that is, newbie) porlet development, and as I advocate for Spring framework I lack knowledge in Spring Porlet MVC as I would like to use it.
I harness this opportunity to ask you other facts:
Why don't you recommend JDBC in porlet development?
Liferay Service Builder is useful, in my opinion, only if tables are stored in the same database as the portal, but what about tables stored outside Liferay database, i.e., suppose one table is for products and it cannot be stored in the same portal database, it has to be in another schema, thus to gather that information Liferay Service Builder cannot be used (in what I know), thus a service strategy must be implemented to access that table data, is it feasible, or what do you advice?
I don't have anything that I can share, although I am hoping to get some stuff into the marketplace so maybe I should get to work on it...
Spring and Vaadin are separate entities. Integrating them is fun. There are some addons from Vaadin which can help with the integration, but you really should know something about both for them to make some sense.
Well, separate questions should be posted as separate threads...
That said, a portal is a cooperative environment. Portlets typically are not islands, they usually are combined visually and interact with each other. Therefore they will also typically need to share entities, DAO layers, etc. If you do not use SB, you risk using many more resources than necessary and have to be concerned with deadlocks and/or update collisions...
Say, for example, you create 5 portlets that you are going to drop onto a single Liferay page. These 5 portlets are related to your bookstore business, and although they are related you have them deployed as 5 separate plugin projects. Each one is going to have to look at your inventory, your customer database, purchase history, etc. in some form or another, either combined or separately.
Now with this scenario, if you're going to use JDBC that means since the 5 projects are deployed separately, they must each have a database connection (or pool of connections) so they can retrieve the data they need to display. This is where the resource consumption increases, because they cannot share the connection pool. Deadlocks and update collisions come into play when you have multiple updators to the data; two portlets updating the same table/data at the same time (likely since the portal page would have all portlets synced up on the same information), each is trying to update the same info at the same time and could be a potential point of collision and/or deadlock.
Now if instead you did things the Liferay way using Service Builder, all of these issues go away. SB code can be used on all 5 of the portlets, so there's no code duplication. The service providing portlet (the one with the service.xml) is the only one with the database connection (pool), so your resource usage is manageable. With only one piece doing the adds/updates/deletes, your collisions and deadlocks are greatly reduced. Finally, since SB enables EhCache (or whatever caching mechanism you're using) for entities, calls to retrieve data might not have to go to the database at all.
SB has it's problems, certainly, but the benefits you garner from using SB from the beginning make it well worth it.
Please sign in to flag this as inappropriate.