Hi
I can't seem to find my way out of this. Basically what I have is something like:
@Embeddable public class EmbeddedBase { ... } @Embeddable public class EmbeddedA extends EmbeddedBase { private String name; getName()... } @Entity public class MyEntity { private Map<String, EmbeddedBase> embeddeds = new ..; getEmbeddeds().. } // Populate MyEntity entity = new MyEntity(); entity.getEmbeddeds().put("test", new EmbeddedA); ... // Try to query using join From<MyEntity> from = criteria.from(MyEntity.class); MapJoin<?,?,?> join = from.joinMap("embeddeds"); Path<?> pathToEmbeddedAName = join.value().get("name") <-- fails with attribute "name" not found
This somewhat makes sense because the underlying type of the join.value() here is "EmbeddedBase" and not "EmbeddedA". However, I do actually know and can make sure that the underlying type in my case is "EmbeddedA" (or any other descendant but I know the type for sure), so I'd need somelike join.value().castUnderylingJavaTypeTo(EmbeddedA.class)? Because odb correctly saves and retrieves the fields, I simply cannot access it using criteria api.. I can also not use metamodel because it is not available for me at that point.. so what am I doing wrong? I can't seem to figure any simple way out of here??
thanks so much
Alex