Ken Turner:
(1) Service Builder is said to use Hibernate. However I am not using this database, so it is unclear whether the approach will work with (say) Hypersonic or MySQL.
Obviously new to development, too, if you don't know Hibernate. Hibernate is an object relational mapping tool which you use so you don't have to do all of the JDBC result set processing on your own.
Hibernate is (for the most part) database agnostic and layers on top of both Hypersonic and Mysql.
(2) It appears that Service Builder generates code for web services. Is that true only for remote use? I would wonder about the efficiency of web services for purely local use.
Yes. For local, you'd use the XxxLocalServiceUtil class to access your service builder entities and methods.
(3) As far as I can tell, Service Builder allows me to manipulate data objects (entities) which then get automatically persisted in a database without requiring any specific actions by the programmer. If so, then there are presumably no "initialize" and "finalize" actions. If my interpretation is correct, this needs to be explained right up front in the Service Builder description.
Not sure what you're asking for here.
(4) Where is "service.xml" fully explained (apart from syntactic aspects in the DTD)? Should I consider <entity> as defining a database table, or perhaps a Java class corresponding to a data object? Is <namespace> meant to be like an XML namespace, or is it just a prefix for automatically generated names? Do I need to define <finder> elements, or are these just a convenience? Do I have to use "companyId" and "groupId" elements if I just need a non-instanceable application?
The DTD is the best documentation for the various XML entities. If you use the Liferay IDE, it has a nice visual editor which can make creating service.xml files a little less verbose.
An entity represents a row of a table. Namespace is used when creating new tables to prefix the table name in the entity object (so you can use a prefix of "MYCOMP" and then use "USER_" as a table name knowing that you will not face collisions with Liferay's "USER_" table.
Finders are a convenience to hide the details of the actual finder implementation rather than having to hand-code all of the various sorts of finders you need.
Company id and group id are used when you need to support Liferay's multi-hosting/multi-group capabilities. For example, if a logical record may have different values for different hosts, the company id will make it a unique row. Same sort of concept with the group; if a record should have one value for group A but a different value for group B, the groupId element will give you a unique row. These have nothing to do with 'non-instanceable applications'.
(5) I have successfully written a "service.xml" file and translated this. I now have a bewildering number of classes with complex relationships (base, implementation, interface, ...). The entry point into these classes is unclear. Some methods are static while others require class instances. I cannot tell what the key classes are and how to use them. Specifically, how should I create instances of my entities, retrieve them, change them and delete them? How should a portlet make use of the generated classes?
The concept that you're not getting is that the generated code is meant to handle crossing the class loader boundary that exists between deployed applications in an application container. Normally an instance of a class cannot be passed to another web application in the same container; class loader issues prevent that. The bulk of the code generated by Service Builder gets around all of these issues so you can effectively share entities across the class loader boundaries.
As far as which classes you should use, it is all down to the XxxLocalServiceUtil classes. Only use that class and the interfaces that it exposes.
When developing your own code, refer to the generated comments in the code that tell you where your changes should be made.
(6) What is the significance of the JAR file that is created in addition to all the generated classes? Can it be ignored, or is it relevant in some circumstances?
This is the service jar for the service you created. It contains the XxxLocalServiceUtil classes and relevant interfaces that other plugins need to access your service. It can only be ignored by plugins that have no need of your service. If your plugin needs the service, it needs the service jar.
(7) Various tutorials extend "XyzLocalServiceImpl". Is it necessary to put anything in this class, or are the extensions an artefact of the tutorial examples? I suspect that it's not necessary at all, and is needed only if some convenience methods are required.
Extension is usually used when you need to change functionality in the existing Liferay service builder entities. By extending their classes you can override their methods with your own. In addition, you end up w/ a change to Liferay's spring configuration to use your extended instance rather than your own.
When you are dealing with your own service entities, extension is not needed and should not be used.
Please sign in to flag this as inappropriate.