Hello! In our compony we need to store information in two different databases. To check if this is possible I've written a simple program, in which part of the entities is stored in one DB, and the other part - in another. And I have an error during deployment whith the following stack trace:
Deployment Error -- Exception [TOPLINK-0] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Exception [TOPLINK-94] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Descriptors must have a table name defined.
Descriptor: RelationalDescriptor(entity.Specification --> [])
Exception [TOPLINK-74] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: The primary key fields are not set for this descriptor.
Descriptor: RelationalDescriptor(entity.Specification --> [])
Exception [TOPLINK-108] (Oracle TopLink Essentials - 2006.4 (Build 060412)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Cannot find value in class indicator mapping in parent descriptor [null].
Descriptor: RelationalDescriptor(entity.Specification --> [])
All I want is to store Specification entity and SalesLineItem entity in different databases, while there's a OneToOne unidirectional relationship between them. Here is part of SalesLineItem entity:
@Entity
public class SalesLineItem implements Serializable {
private int quantity;
private Specification productSpec;
private int id;
private Sale sale;
...
@OneToOne
public Specification getSpecification() {
return this.productSpec;
}
And here's my persistence.xml:
<!--?xml version="1.0" encoding="UTF-8"?-->
jdbc/__default
entity.Payment
entity.Sale
entity.SalesLineItem
true
jdbc/__resource
entity.Catalog
entity.Specification
true
Then, I suppose, I create two EntityManger is session beans, each associated with one specific persistence unit.
When I use one database (one pesistence-unit in persistence.xml), everything works fine. I wonder, if it's possible to persist entities in a such way that entities with relationships between them are stored in different databases. Any help is greatly appreciated.