public Integer addBook(Map attributes, String publisherName)
throws CreateException, RemoteException
{
IPublisher publisher = null;
IPublisherHome publisherHome = getPublisherHome();
// Find or create the publisher.
try
{
publisher = publisherHome.findByName(publisherName);
}
catch (FinderException e)
{
// Ignore, means that no publisher with the given name already
// exists.
}
if (publisher == null) publisher = publisherHome.create(publisherName);
attributes.put("publisherId", publisher.getPrimaryKey());
return addBook(attributes);
}