Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Why cant i overload a method using an arryalist as the parameter?
Christopher Whu
Ranch Hand
Posts: 80
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
just wondering why this is acceptable
protected void saveOrUpdate(Object obj) { try { startOperation(); session.save(obj); session.getTransaction().commit(); } catch (HibernateException e) { handleException(e); } finally { session.close(); } } protected void saveOrUpdateM(Object[] objectList){ try{ startOperation(); for (int i=0;i<objectList.length;i++) { session.saveOrUpdate(objectList[i]); } } catch (HibernateException e) { handleException(e); } finally { session.getTransaction().commit(); session.close(); } }
but this is not (an arraylist instead of a array)
protected void saveOrUpdate(Object obj) { try { startOperation(); session.save(obj); session.getTransaction().commit(); } catch (HibernateException e) { handleException(e); } finally { session.close(); } } protected void saveOrUpdateM(ArrayList><Object> objectList){ try{ startOperation(); for (int i=0;i<objectList.size();i++) { session.saveOrUpdate(objectList.get(i)); } } catch (HibernateException e) { handleException(e); } finally { session.getTransaction().commit(); session.close(); } }
thanks in advance!>
Tony Docherty
Bartender
Posts: 3323
86
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Those aren't examples of overloading as the method names are different.
Also, in the second example, the parameter signature is wrong - you have an spurious '>' character in there.
Campbell Ritchie
Marshal
Posts: 79177
377
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a suspicion the > has been added by the forum software as a mistake. I have seen that happen before.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
HQL query for year
LazyInitializationException [spring + struts2]
Rollback issue with Hibernate in JBoss
type casting
Hibernate problem
More...