datanucleus-rdbms icon indicating copy to clipboard operation
datanucleus-rdbms copied to clipboard

Support relationships between views

Open spassignat opened this issue 2 years ago • 1 comments

Hello, If we have a model like User -->* Role mapped on views RoleView, UserView, read operation works very well, but schemaTool (or auto-create) does not know how to deal with that situation.

I tested it on version 5.2 and the latest 6.0 available and didn't find in groups.io information. Please find the attached testcase.

Here is the Exception: java.lang.ClassCastException: class org.datanucleus.store.rdbms.mapping.java.BigIntegerMapping cannot be cast to class org.datanucleus.store.rdbms.mapping.java.MultiMapping (org.datanucleus.store.rdbms.mapping.java.BigIntegerMapping and org.datanucleus.store.rdbms.mapping.java.MultiMapping are in unnamed module of loader 'app') at org.datanucleus.store.rdbms.mapping.CorrespondentColumnsMapper.(CorrespondentColumnsMapper.java:254) at org.datanucleus.store.rdbms.mapping.java.PersistableMapping.prepareColumnMapping(PersistableMapping.java:242) at org.datanucleus.store.rdbms.mapping.java.PersistableMapping.initialize(PersistableMapping.java:130) at org.datanucleus.store.rdbms.mapping.MappingManagerImpl.getMapping(MappingManagerImpl.java:663) at org.datanucleus.store.rdbms.table.ClassView.initialize(ClassView.java:135)

The limitation seems to be the ClassView which consider a view does not have an id, which is not always the case. I think having id in view could help with caching, at least to have it optional dn-view.zip .

spassignat avatar Mar 24 '22 10:03 spassignat

An RDBMS "VIEW" doesn't have a primary key in most treatments of VIEW.

andyjefferson avatar Mar 24 '22 18:03 andyjefferson