Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] ManyToManyMapping.setSourceRelationKeyFieldName(String name) act as "add", not "set"

I've to make some customization in the descriptor at application start, and there is an weird behavior I can't deal with. In the following code, I want to change from tables to a bunch of views from a remote database:

public class JPACustomizer implements SessionCustomizer {
  public void customize(Session session) throws Exception {
        ClassDescriptor cdg = session.getDescriptor(Grupo.class);

ManyToManyMapping map = (ManyToManyMapping)cdg.getMappingForAttributeName("uriPath");
        map.setRelationTableName("vi_grupo_uripath");
map.setSourceRelationKeyFieldName("vi_grupo_uripath.grupo_id");
map.setTargetRelationKeyFieldName("vi_grupo_uripath.uripath_id");
...

The problem is that when I run the application, I still have the mapping for old table - the "set" just "added" another field mapping to SourceRelation and TargetRelation collections.

How to deal with that? What is the right way to change the relation at runtime?

Thanks,

Edson Richter



Back to the top