public PersistenceDescriptorImpl(String descriptorName, Node node) { super(descriptorName); this.model = node; addDefaultNamespaces(); }
/** * Adds the default namespaces as defined in the specification * @return the current instance of <code>PersistenceDescriptor</code> */ public PersistenceDescriptor addDefaultNamespaces() { addNamespace("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addNamespace("xsi:schemaLocation", "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"); addNamespace("xmlns", "http://java.sun.com/xml/ns/persistence"); return this; }
/** * If not already created, a new <code>persistence-unit</code> element will be created and returned. * Otherwise, the first existing <code>persistence-unit</code> element will be returned. * @return the instance defined for the element <code>persistence-unit</code> */ public PersistenceUnit<PersistenceDescriptor> getOrCreatePersistenceUnit() { List<Node> nodeList = model.get("persistence-unit"); if (nodeList != null && nodeList.size() > 0) { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, nodeList.get(0)); } return createPersistenceUnit(); }
/** * If not already created, a new <code>persistence-unit</code> element will be created and returned. * Otherwise, the first existing <code>persistence-unit</code> element will be returned. * @return the instance defined for the element <code>persistence-unit</code> */ public PersistenceUnit<PersistenceDescriptor> getOrCreatePersistenceUnit() { List<Node> nodeList = model.get("persistence-unit"); if (nodeList != null && nodeList.size() > 0) { return new PersistenceUnitImpl<PersistenceDescriptor>(this, "persistence-unit", model, nodeList.get(0)); } return createPersistenceUnit(); }
public PersistenceDescriptorImpl(String descriptorName, Node node) { super(descriptorName); this.model = node; addDefaultNamespaces(); }
/** * Adds the default namespaces as defined in the specification * @return the current instance of <code>PersistenceDescriptor</code> */ public PersistenceDescriptor addDefaultNamespaces() { addNamespace("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); addNamespace("xsi:schemaLocation", "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"); addNamespace("xmlns", "http://java.sun.com/xml/ns/persistence"); return this; }