Hi,
If I understand the maps.qjml file that comes with
osage-1.0pre10,
default values can be declared for fields. But with
default elements
defined, I get an exception:
net.sourceforge.osage.mapping.MappingException: Nested
error: com.jxml.quick.QPE: no match: default.
maps.qjml reads, in part, for element field:
<element name="field">
...
<child element="default" repeating="False"
optional="True" property="defaultMap"/>
</element>
and element default reads:
<element name="default" content="EMPTY">
<targetClass>net.sourceforge.osage.mapping.DefaultMap</targetClass>
<attribute name="value" type="string"
property="value"/>
<attribute name="holder" type="string"
property="holder" />
</element>
In my class map, I have fields defined like
this:
<field name="parent_id" type="integer">
<default value="0"/>
</field>
<field name="top_id" type="integer">
<default value="0"/>
</field>
<field name="path" type="string">
<sql length="255"/>
<default value=""/>
</field>
<field name="dir_name" type="string">
<default value=""/>
</field>
Which, in my novice mind, seems to be acceptable
according
to the maps.qjml. What am I missing?
Thank you.
Lee Fellows
Logged In: YES
user_id=28717
Hi Lee,
"sql" is a required element. btw, you don't need defaults
for primitive types where the value is equal to the one set
by construction. e.g., you don't need int = 0. This
happens with construction of the class.
Regards, george
Regards, george
Logged In: YES
user_id=163683
Hi George,
Thank you, but I still get the same exception. I added
the sql element
to every field element and deleted all the default
assignments (I think)
that were unnecessary. But that still leaves defaults for
string items.
I suspect I must be missing something, but I do not know
what. Any
suggestions?
Thank you.
Lee Fellows
Logged In: YES
user_id=28717
Hi Lee,
It's hard to give you much help without the complete class
map for the problem. Even with this it's difficult because
the exception is in 3rd party package (quick).
Did you get the examples to work? There was a default in
one of the example classes.
Regards, george
Logged In: YES
user_id=163683
Hi George,
Yes, I saw the default field used in the examples. To
your question:
yes, the examples seem to work fine. That is why I am
confused by
its rejecting my class mappings with default fields. If I
comment out the
default fields, then the classes build seemingly fine.
I have attached the class mappings category.xml and
categorycomp.xml
along with my configuration file: airsconf.xml. Any
feedback is welcome.
Note that the default fields are commented out in the
attached files, but
otherwise remain unmodified from my last attempt to generate
the classes
with them in place.
My last day here is today, so any response will not be of
value to me
past the end of business today.