Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
HbnContainer @ManyToMany Problem
hi,
just to finalize this post, i solved this by getting all the ids from the relation table
List<?> resultTest = getSession()
.createSQLQuery(
"select id from movie where id in ( select movie_id from movie_genre where genres_id in ("
+ event.getProperty().getValue()
.toString() + ") )").list();
and afterwards i select it with an InContainerFilter
ApplicationSettings
.getMovieContainer()
.addContainerFilter(
new InContainerFilter("id", resultTest));
InContainerFilter:
@Override
public Criterion getFieldCriterion(String fullPropertyName) {
if(collection.size()>0)
{
return Restrictions.in(fullPropertyName, collection);
}
else
{
// bad solution, unnecessary select
return Restrictions.eq(fullPropertyName, -1);
}
}
this means 2 db calls, but it works, and it is used in a non-often frequently used part of application
therefore its fine for me :)
######################
hi all,
i have the following problem:
Entity movie has a relation to its fees
@ManyToMany(fetch=FetchType.EAGER)
private Set<Fee> fees;
by the way ... Entity fee has no ManyToMany for movie, its not necessary isn it ?
and now i want to show with HbnContainer only movies with ID 4,5
i create a special containerfilter by overriding getFieldCriterion ( this is working with other Restrictions like between etc. )
@Override
public Criterion getFieldCriterion(String fullPropertyName) {
return Restrictions.in(fullPropertyName, new String[] { "4","5" } );
}
fullPropertyName = "fees"
console output:
Hibernate: select this_.id as id3_8_, this_.customer_id as customer7_3_8_ ...
Hibernate: select count(*) as y0_ from Movie this_ where this_.id in (?, ?)
WARN [http-8080-exec-10] (JDBCExceptionReporter.java:100) - SQL Error: 0, SQLState: 22023
ERROR [http-8080-exec-10] (JDBCExceptionReporter.java:101) - Für den Parameter 1 wurde kein Wert angegeben. / Missing parameter
the first select has many joins and looks quite good for me ...
finally i want to say, i was trying to resolve this by searching forum/google without success
i found some information that manytomany with HbnContainer is not possible
thread: https://vaadin.com/de/forum/-/message_boards/view_message/238500
but maybe u can give me an alternative -
nothing is unsolvable :)
thanks
Chris