I am using the classes that Hibernate-tools created for me.(i reverse engineered my database)
It seems like Hibernate stores the entries that are mapped to another one as a foreign key
in a Set(HashSet).And i am guessing that it would be better to have them stored in a List
or ArrayList since i will display those data in a table using JSF,and with Lists reaching the data
easier(using get(index)).(i dont know if i can send a Set into a datatable or not).
According to the situation,what do you advice me?Should i change Set variables to List's?
Would that make a problem?
I was doing JSF/Hibernate work, and found it more than annoying dealing with the fact that JSF components don't like Sets. I'm not sure why the h:dataTable couldn't just take a collection as an argument, and boht a Set and java.util.List would work? I'm sure there's a good reason, but it does make it difficult when you've got a set and need a List.
I grabbed this makeList class which is documented in this blog. It gets around the List/Set problem fairly nicely.
Well, on my point about not understanding why the h:dataTable can't take a simple Collection, here's a response:
One of the more personally surprising usability complaints I've heard was that the JSF UIData component does not support Sets. I hadn't anticipated that one. The underlying reason is that UIData is built around indexed data. For example, you can ask it to show rows 10,000 through 10,099. Such an operation would be nightmarishly expensive in a Set:
So ,i assume that using an iterator to migrate the data into a List
would be a more costly solution.I know this will sound silly but
can you give me a short explanation about how to utilize from
that ListFromCollection class since it has no method which
gets a Set as an argument and returns a List.
Faith, that code worked, and I could just pass it a set, and the dataList used it as a List.
I looked at that code a million times, looking for arguments passed in and constructors and what have you, and I couldn't 'freakin' figure out what the heck was going on. Seriously, it bugged me big time.
It could be Haitian Vodoo or Cosmic Energy or something of the like. I really have no idea. But the darn thing worked and got me out of a pickle. Maybe you can figure it out and explain it to me?
posted 11 years ago
..I wish i could..As a noob,i used an iterator to save the data into a list,and sent this list
to a datagrid.
Now my problem is,i want to navigate to the movie page whose image is clicked.
But the choosen movie whose image is clicked,is an element of the list.
I can neither directly get the data of that object(Movie),nor take it from the list(i dont know its index) on the next page.
I need to send the clicked movie's id into a movieBean class method and retrieve the info of
that movie to use on the next page.Can anyone suggest me an idea ?
And then the flying monkeys attacked. My only defense was this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!