Question
What is the difference between getCurrentSession and openSession methods ?

Answers

SessionFactory.openSession():

1) It always create new Session object.
2) You need to explicitly flush and close session objects.
3) In single threaded environment , It is slower than getCurrentSession.
4) You do not need to configure any property to call this method.

SessionFactory.getCurrentSession():


1) It creates a new Session if not exists , else use same session which is in current hibernate context.
2) You do not need to flush and close session objects, it will be automatically taken care by Hibernate internally.
3) In single threaded environment , It is faster than getOpenSession
4) You need to configure additional property. "hibernate.current_session_context_class" to call getCurrentSession method, otherwise it will throw exception   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q About what number of percent of the world’s water is strong
  • Q What is an NSOperationQueue and how/would you use it in iOS operating system?
  • Q How do I make Finger and whois work through my firewall?
  • Q How good are your teachers at school then?
  • Q You are creating an order entry application named TestKiEntry. You set Orders.aspx as the start page. You want users to log on to Orders.aspx by supplying a user name and password. You create a Login.aspx page to validate the user name and password. You need to ensure that users log on by using Login.aspx before they are allowed to access Orders.aspx. Which two courses of action should you take? (Each correct answer presents part of the solution. Choose two) A. In the authentication section of the Web.config file, set the mode attribute of the authentication element to Forms. Set the name attribute of the forms element to Login.aspx. B. In the authentication section of the Web.config file, set the mode attribute of the authentication element to Forms. Set the loginUrl attribute of the forms element to Login.aspx. C. In the authorization section of the Web.config file, set the users attribute of the deny element to ?: D. In the credentials section of the Web.config file, set the users attribute of the deny element to ?. E. In the credentials section of the Machine.config file, set the users attribute of the deny element to *. F. In the authorization section of the Machine.config file, set the mode attribute of the authentication element to Forms. Set the policyFile attribute of the trust element to Login.aspx. G. Create a Page directive in Orders.aspx to load the Login.aspx page.
  • Q Alzheimer's Society job roles and responsibilities? Alzheimer's Society job duties?
  • Q Global warming is due to the release of ______ gas.
  • Q Explain egp (exterior gateway protocol)?
  • Q What is the difference between xml web services using asmx and .net remoting using soap
  • Q List the standard MIS reports available in PM.
  • Q Is knitting fabric produce by inter looping?