*/
private void validateSupportedType() {
// log warnings about things we don't handle
OpenJPAConfiguration conf = getRepository().getConfiguration();
Collection<String> opts = conf.supportedOptions();
Log log = conf.getLog(OpenJPAConfiguration.LOG_METADATA);
switch (getTypeCode()) {
case JavaTypes.PC:
if (isEmbedded() && !opts.contains(
OpenJPAConfiguration.OPTION_EMBEDDED_RELATION)) {
setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed", this));
} else
if (isEmbedded() && getDeclaredTypeCode() != JavaTypes.PC) {
setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed-extern", this));
}
break;
case JavaTypes.COLLECTION:
if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_COLLECTION))
throw new UnsupportedException(
_loc.get("type-not-supported",
"Collection", this));
if (_elem.isEmbeddedPC() && !opts.contains(
OpenJPAConfiguration.OPTION_EMBEDDED_COLLECTION_RELATION)){
_elem.setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed-element", this));
}
break;
case JavaTypes.ARRAY:
if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_ARRAY))
throw new UnsupportedException(
_loc.get("type-not-supported",
"Array", this));
if (_elem.isEmbeddedPC() && !opts.contains(
OpenJPAConfiguration.OPTION_EMBEDDED_COLLECTION_RELATION)) {
_elem.setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed-element", this));
}
break;
case JavaTypes.MAP:
if (!opts.contains(OpenJPAConfiguration.OPTION_TYPE_MAP))
throw new UnsupportedException(
_loc.get("type-not-supported",
"Map", this));
if (_elem.isEmbeddedPC() && !opts.contains(
OpenJPAConfiguration.OPTION_EMBEDDED_MAP_RELATION)) {
_elem.setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed-element", this));
}
if (_key.isEmbeddedPC() && !opts.contains(
OpenJPAConfiguration.OPTION_EMBEDDED_MAP_RELATION)) {
_key.setEmbedded(false);
if (log.isWarnEnabled())
log.warn(_loc.get("cant-embed-key", this));
}
break;
}
}