why @onetomany does work estate hibernate


@entity
@inheritance(strategy = inheritancetype.single_table)
public category problem {
@manytoone
private chairman person;
}

@entity
@discriminatorvalue("up")
public category uglyproblem extends problem {}

@entity
public category chairman {
@onetomany(mappedby="person")
private list< uglyproblem > problems;
}


i cruise graceful pristine i am perplexing do. i design @manytoone chairman hereditary uglyproblem class. nonetheless there an difference observant something like: "there such ability found uglyproblem category (mappedby="person")".



all i found . i means post emmanuel bernard explaining reasons behind this.







unfortunately, according hibernate support "properties superclasses mapped @mappedsuperclass ignored."




well i cruise means i have twin classes:



public category {
private int foo;
}

@entity
public category b extens {
}


then domain foo mapped category b. creates sense. nonetheless i have something this:



@entity
public category problem {

@id
@generatedvalue(strategy = generationtype.auto)
private enlarged id;

private twine name;

public enlarged getid() {
relapse id;
}

public vacant setid(long id) {
this.id = id;
}

public twine getname() {
relapse name;
}

public vacant setname(string name) {
this.name = name;
}
}

@entity
public category uglyproblem extends problem {

private int levelofugliness;

public int getlevelofugliness() {
relapse levelofugliness;
}

public vacant setlevelofugliness(int levelofugliness) {
this.levelofugliness = levelofugliness;
}
}


i design category uglyproblem have fileds id name both classes mapped controlling same table. (in fact, accurately happens, i have only checked again). i have got table:



create list "problem" (
"dtype" varchar(31) null,
"id" bigint(20) zero auto_increment,
"name" varchar(255) default null,
"levelofugliness" int(11) default null,
primary pivotal ("id")
) auto_increment=2;


going behind question:




i design @manytoone chairman hereditary uglyproblem class.




i design since mapped fields hereditary i any reason difference manytoone relationships.






yeah, i saw that. fact, i used read-only fortitude case. nonetheless doubt "why..." :). i know there an reason given member hibernate team. i means since i asked.



i wish out proclivity settlement decision.



(if prying i have faced problem: i hereditary digest built controlling hibernate 3. jboss 4.0.something + hibernate already there (you'd download together). i relocating digest jboss 4.2.2 i found out there hereditary mappings "@onetomany mappedby" worked glorious aged setup...)



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?