In my current project I am using a 3rd party library which has no JPA annotations.
How can I persist objects from that library using JPA and external mappings?
Check this and this. In short:
META-INF/orm.xml.xsdYou don't have to manually map each column - only some specifics (i.e. collections and the id) are required. All fields are assumed to be columns (if the class is mapped). If there are no collections, something like this suffices:
External entities from library X
com.external.library
..
..
Note that when specifying you don't need fully-qualified names.
In case you want a file named differently than orm.xml, in your persistence.xml specify it via:
customMappingFile.xml