} else if (locator instanceof EntityEJBLocator) {
final Marshaller marshaller = factory.createMarshaller(configuration);
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
marshaller.start(new OutputStreamByteOutput(stream));
marshaller.writeObject(((EntityEJBLocator) locator).getPrimaryKey());
marshaller.finish();
return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
}
throw EjbLogger.EJB3_LOGGER.unknownEJBLocatorType(locator);
} else {
throw EjbLogger.EJB3_LOGGER.incorrectEJBLocatorForBean(locator, ejbComponent.getComponentName());