[odb-users] Delayed initialization of polymorphic_entry_for_X and create_schema_entry_

steffen at boast.nl steffen at boast.nl
Thu Jan 14 11:08:16 EST 2016


I ran into a problem which I think is related to delayed initialization 
of the variable polymorphic_entry_for_X.

I have a polymorphic object structure that is peristed to ODB, say A : 
B. I now try to read all objects using database.query<B>(). Entities are 
stored using perist(QSharedPointer<B>); Thus, odb is never (compile 
time) made aware of the existence of type A in this case. I have two 
applications with the same code; one works, one throws a "no type 
information" exception?

By adding a reading database.query<A>() to the code, it works in both 
applications. As the code is shared between the two application, the 
only cause I can think of is a delayed initialization of 
polymorphic_entry_for_A. Is that correct?

Also, can the same problem occur on create_schema_entry_? I have more 
situations where I expect ODB to have knowledge of all my classes while 
they are not explicitly used. To my current understanding of C++ you can 
not guarantee this right? Should I make a (compile time) reference to 
all the odb generated code to be sure, or am I missing something?



More information about the odb-users mailing list