java - Problems with ArrayList items and hibernate -
I have a problem getting the list item, below is my hibernate code, after that code is my method .. and Below is my junit test. How can I ensure that the query is being executed correctly, and how can I check that the results actually work. This query should return some piids .. and list them Should be put in .. Now I'm 90% sure that mer The list should always be empty .. Instead of 3 pids should be: 4573, 4593, 4693 .. Anyone can understand what I am doing wrong .. Why pids are not on my list ..
& lt; Sql-query name = "endDateChecker" & gt; & Lt; Return-scaler column = "PID" type = "java.lang.Long" /> & Lt ;! [CDATA] Select PID as PID from the information where end_date is & lt; TRUNC (sysdate)]] & gt; & Lt; / SQL query & gt;
& lt; -IBNet ->
public list & lt; Long & gt; FindItemByPIdEndDate () throws ROSException {list & lt; Long & gt; List = null; {Try session session = sessionFactory.getCurrentSession (); Query Query = session.getNamedQuery ("endDateChecker"); List = query.list (); For (long 1: list) {logger.info (long1); }} Catch (Hibernate Expression E) {New DataAvset Accession (EAM MESSAGE ()); } Return list; }
& lt; -METHOD ->
Public class FindItemByPIdEndDateTest {Personal Static Last Log Logger = ROSLogFactory.getLog (FindItemByPIdEndDateTest.class); Private applicationcontact beenfacture; Private firmness Mngt LPS = Faucet; @public zero setup () throws an exception before {beanFactory = new classpathxmlApplicationContext ("/ resources / ros-conf / engine-conf / applicationContext.xml"); LPS = (stability) beenfactor.getben ("firmly Mars service"); } @Efter Public Empty Down Down () throws exceptions {} @Test PublicWheelTestFindItimByPaidAndDetate () {list & lt; Long & gt; Itemdb = null; Try {itemdb = lps.findLroByPIdEndDate (); // assertNull ("list is empty", itemdb); // Aschure Aqual (4573, ITDB. Indexoff (0)); // AssertEquals (3, itemdb.size ()); // Ascher Aqual (4593, ITDB. Indexoff (1)); // Ascher Aqual (4693, ITDB. Indexoff (2)); } Catch (ROSException e) {e.printStackTrace (); Unsuccessful (e.getMessage ()); }}}
& lt; -TEST ->
that you have
type = "java. Lang.Long "instead of type =" tall "
"
As it is?
Comments
Post a Comment