When I Generate POJOs from DBVA 4.2, I get the following Error.
Class <<class-name’s>> attribute (<> : java.lang.Double) must specify a supported type.
I am getting these errors for Long, Double, Float and Custom Data Types(Classes of our Model).
But java.math.BigDecimal and java.lang.Integer work fine.
I tried specifying these data types in the Modeling -> Application Options -> Data Types -> UML and also in Modeling -> Application Options -> Data Types -> Java.
But this did not help.
Any suggestions on how to resolve it? Requesting help on this.
Would you mind send me your project file to have a look? Thanks in advance!
I am attaching a dummy project here with the same issues. I am getting these data type related errors while generating code (POJOs).
There are 3 problems in your drawing.
The attribute “class1” in class “Class2” cannot be typed as “Class1”. If you want to relate this attribute with Class1, please use association instead.
This is our mistake - The type for attribute cannot be fully qualified. If you want to use Long, type “Long” instead of “java.lang.Long”. I already reported this problem to our team for bug fixing.
Class1 need to be “ORM Persistable”. You can set it by assigning it with “ORM Persistable” stereotype.
I am attaching an image to show you the correct way of drawing.
I would like to notify you that the problem of code generating is fixed and deployed. You can download and try the build in the following link.
I hope this solves your problem.
Thank you very much, Jick & Wong.
You guys have been very helpful.
Just wanted to confirm that if Class A is required to have 3 attributes (after code generation) with the data type as Class B, then we should have 3 Relations from Class A to Class B, with the role names matching the required attribute names.
I tried this after Jick suggested that I should create a relation from Class A to Class B, instead of directly having an attribute with Type B, inside A.
I created 3 relations from A to B & I got 3 attributes (after code generation) in A, with Type B.
Is this the required approach?
Actually it is not necessary to have 3 association pointing to 3 attributes. By defining the name and type in association end already represent it will become an reference attribute in generated code. Defining both association end and attributes will only causing duplicated attribute. If you require any further information, please do not hesitate to contact me again.
Oh, I think I did not explain properly.
When I created the 3 relations, I removed the 3 attributes from the model that were present earlier. Then, when I generated the code, I got those 3 attributes in the code.
What I really needed the confirmation for is whether it is fine to have 3 relations from Class A to Class B, or can there be any issues with that?
It is absolutely fine to have 3 relationships from Class A o Class B. The meaning is just same as having 3 attributes in Class A which type is Class B.