Aggregated object not appearing in POJO

I have an aggregation relationship like this

    ClassA (1)  aggregates -> Class B (0..*)

ClassB is non-persistable object. 
This aggregation relationship also is non-persistable.

In the ClassA.java normally I would have a set of ClassB Object.

public class ClassA
{
    private java.util.Set   ClassBs = new java.util.HashSet();
}

But in this case (when the relationship is non-persistable), set of ClassB is not appearing in ClassA. How to fix this ?

Hi Rameshg,

Thanks or your post. Currently our design is that only ORM-persistable classes will be generated in code, so your ClassB and the relationship need to be ORM persistable as well for getting the code you are looking for (also need to assign role names in the relationship).

However, we will study the possibility to generate code for non-persistable classes in the future. If there is any news about this issue, I’ll notify you immediately.

If there are any further inquiry, please do not hesitate to contact me.

Best regards,
Lilian Wong

Though, ClassB does not have a database mapping, I have already marked ClassB as ORM persistable. I am doing this just to get ClassB.java, and ignoring the ClassB.hbm.xml generated by the tool.
A kind of workaround just to get the Java code for the class I modeled.

But I can not make the “relationship” between ClassA and ClassB persistable. If I do so, ClassA.hbm.xml will not be correct.
Then ClassA.hbm.xml is going to have an entry for this relationship, and will expect a database foreign key.
This foreign key does not exist because ClassB is not in database.

There is a mismatch in the way the code generator handles non-persistable attribs Vs non-persistable classes / relationships.
When I mark an attribute as non-persistable I still get it in Java code but it will not be found in the hbm.xml, which is working for me perfectly.

There should be a way to do the same for classes / relationships.
I think, the persistence property should have its impact only in hbm.xml and it should no way affect the Java Code.

Is there at least an workaround I can follow ? because I have many non-persistable classes in my model.

Hi Rameshg,

Thanks for your reply and the details. We will consider to generate code for non-persistable class for sure, I’ll keep you informed for any news about this issue.

Please do not hesitate to contact me if you need any help.

Best regards,
Lilian Wong