Saturday, 15 February 2014

java - customizing fetch type in hyperjaxb -



java - customizing fetch type in hyperjaxb -

i read this link fetchtype in hyperjaxb. looks of it, seems 1 can add together simpletype fetch-type xsd file , add together fetch attribute every complextype.

how customize next xsd fragment resulting java method @ bottom below have fetchtype=lazy annotation?

<xs:complextype name="sometypename"> <xs:sequence> <xs:element name="title" type="xs:string" minoccurs="0" maxoccurs="unbounded"/> <xs:element name="somecode1" type="code" minoccurs="0"/> <xs:element name="somecode2" type="code" minoccurs="0"/> <xs:element name="somecode3" type="code" minoccurs="0"/> <xs:element name="somecode4" type="code" minoccurs="0"/> <xs:element name="somecode5" type="code" minoccurs="0"/> </xs:sequence> </xs:complextype> <xs:complextype name="code"> <!--<xs:sequence>elements nested info types omitted simplicity</xs:sequence>--> <xs:attribute name="code" type="xs:string" use="optional"></xs:attribute> <xs:attribute name="name" type="xs:string" use="optional"></xs:attribute> </xs:complextype>

here java property should fetchtype=lazy:

@manytoone(targetentity = code.class, cascade = { cascadetype.all }) @joincolumn(name = "some_code1_p_0") public code getsomecode1() { homecoming somecode1; }

also, how (i.e. specific syntax) 1 set global default fetchtype in methods, properties have overridden?

please see similar question illustration on cascade asked previously:

customizing hibernate properties in hyperjaxb

and check hyperjaxb customizations schema uses jpa orm schema:

many-to-one/@fetch fetchtype

this result like:

<jaxb:bindings schemalocation="schema.xsd" node="/xs:schema"> <hj:persistence> <hj:default-many-to-one fetch="lazy"> <!-- ... --> </hj:default-many-to-one> </hj:persistence> </jaxb:bindings>

if want fetch="lazy" on of associations, you'll have customize default-one-to-one, default-one-to-many, default-many-to-many well. these customizations applied globally (the semantics of "default mappings"). don't have customize hundreds of properties.

hyperjaxb has 3 levels of mappings:

built-in defaults - built-in default mappings. these hyperjaxb inner defaults customized default mappings - defaults can customize per schema. if you're not happy defaults reason, can provide own default mappings - there, want them different built-in defaults. customized property , association mappings or classes - things customize per specific class, property or association. again, there want them different customized or built-in defaults.

these levels of customizations inherit each other. if don't customize, you'll built-in defaults applied.

concerning feedback on quality of hyperjaxb documentation. absolutely agree extremely far beingness optimal (never disputed this, actually).

but best state possible @ moment. not have resources actively develop or promote project. hyperjaxb niche tool suites limited number of projects or applications. there some, low user/developer involvement makes economically not viable develop , maintain total or part-time.

to set frankly, options @ moment are:

close , abandon project leave on low-flame maintenance

i'd close , abandon project long ago, but:

i know there users quire happy hyperjaxb, is. i not know analog hyperjaxb, provide - remotely - same functionality , power. "analog" mean generate jpa-enabled classes based on xml schema. of course of study there other tools, brilliant moxy utilize other sources (java classes, uml, whatever), know no other tool xsd->java+jpa. unfortunately seems have developed unique tool.

so in situation can leave project on low flame, fixing severe bugs , issues. documentation raises treshold on required experience , eagerness larn tool. argue there means this: there 50+ pages of documentation, ready-to-run tutorials , samples, "just add together water" template projects, 60+ test projects available. sure raise treshold.

and sorry not work you. please take apologies not fulfilling expectations.

the feedback "your documentation poor", no matter how true is, not helpful contribution. give thanks feedback, no, don't have resources work harder create hyperjaxb easier use.

a helpful contribution be:

reporting bugs , issues reproduced , fixed. providing pull requests review , merge them. helping out documentation.

java jpa jaxb xsd hyperjaxb

No comments:

Post a Comment