| @UnionPartitioning does not seem to be using the correct connection pool [message #676447] |
Sat, 04 June 2011 09:28  |
Mark Ashworth Messages: 8 Registered: March 2010 |
Junior Member |
|
|
When using @UnionPartitioning with the default and named connection pools and the entity is loaded from the named connection pool, the UPDATE to the entity seems to be routed to the default connection instead of the named connection.
The reason for the named connection is to load the entities from the main database schema and from the archive schema. What might be better that getting the UPDATE to route to the archive schema, is be able to have an listener that is able to set a property on the result domain entity that it is a archived entity and therefore no UPDATE/DELETE function should be performed.
I have the following entity mapping:-
@Entity(name = "TrainingCourse")
@Access(AccessType.FIELD)
@Table(name = "course")
@UnionPartitioning(
name="UnionPartitioningAllNodes",
/*Do not replicate changes to all data sources*/
replicateWrites=false)
@Partitioned("UnionPartitioningAllNodes")
public class TrainingCourse extends DomainEntity {
@Id
@Column(name = "course_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
....
@Version
@Column(name = "version")
}
And I have setup the following connection in the persistence.xml
<property name="eclipselink.connection-pool.archive.jtaDataSource" value="yellowfire.training.archive.ds" />
Thank you in advance
|
|
|
| Re: @UnionPartitioning does not seem to be using the correct connection pool [message #676846 is a reply to message #676447] |
Mon, 06 June 2011 13:40   |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
The UnionPartitioning as you have specified it will only affect reads, so write will go to the default data-source.
In order to partition the writes, you must use some other form of partitioning. Perhaps add an isArchived field and use ValuePartitioning on it.
But, if the objects are suppose to be read-only anyway, then it seems your application code is wrong if it is changing the objects. If you don't change the objects, then they will not be updated.
James : Wiki : Book : Blog
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01706 seconds