hibernate - HQL JoinTable not accessible -


i have many many relationship between media , tags:

medium:

@manytomany(fetch=fetchtype.eager) @indexcolumn(name="tags_index_column") @jointable(name="tag_map",           joincolumns={@joincolumn(name="tag_id")},           inversejoincolumns={@joincolumn(name="item_id")}) private list<tag> tags; 

tags:

@manytomany(mappedby="tags") @jointable(name="tag_map",         joincolumns={@joincolumn(name="item_id")},               inversejoincolumns={@joincolumn(name="tag_id")}) private list<medium> media; 

i try query join table hql exception:

string resultquerystring = "from tag_map"          query resultquery sessionfactory.getcurrentsession().createquery(resultquerystring); 

exception:

org.springframework.orm.hibernate3.hibernatequeryexception: tag_map not mapped [from tag_map]; nested exception org.hibernate.hql.ast.querysyntaxexception: tag_map not mapped [from tag_map] 

what want query media has tag specific id. unfortunately can't access jointable.

any suggestions? :)

hql queries written in terms of entities, not tables, therefore can't query arbitrary table table.

so, need formulate query in terms of logical relationships between entites rather accessing join table directly, this:

select m medium m join m.tags t t.id = ? 

see also:


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -