Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6549815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:08:22+00:00 2026-05-25T12:08:22+00:00

I have a simple code snippet provided below along with the necessary hibernate configuration.

  • 0

I have a simple code snippet provided below along with the necessary hibernate configuration.
The issue is all the ‘insert’ statements are being printed but ‘select’ statements are not printed.

Session sess = session.openSession();
Transaction tx = sess.beginTransaction();
Address addr = new Address();
addr.setStreet("street");
Employee pojo = new Employee();
pojo.setName("XYZ");
pojo.setAddress(addr);
System.out.println("ID " + pojo.getId());
sess.saveOrUpdate(pojo);
tx.commit();
session.close()

The above code prints ‘insert’ statements in standard output

Session sess = session.openSession();
Transaction tx = sess.beginTransaction();
Employee pojo = (Employee) sess.get(Employee.class, 1);
System.out.println(pojo.getName());
System.out.println(pojo.getAddress().getStreet());
tx.commit();
session.close();

The above code does not print the ‘select’ statement. I have tried using load() instead of get(), but the result is the same.

This configuration is available in hibernate configuration.

<property name="show_sql">true</property>

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:08:23+00:00Added an answer on May 25, 2026 at 12:08 pm

    If you have second level cache enabled, selects will not be executed and value will be taken from cache instead. Try to read data that is already in DB rather than what you have just inserted. I assume that you first do insert and then read it right after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple code below: import java.util.ArrayList; public class BoidList extends ArrayList {
I have prepared a simple code snippet in order to separate the erroneous portion
I have a really simple snippet of code and a really (probably) simple change
I have following simple code snippet: StringBuilder sb = new StringBuilder(); Locale l =
So I have this simple code snippet: CString str; .................. if ( str.IsEmpty() )
Very simply put, I have the following code snippet: FILE* test = fopen(C:\\core.u, w);
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have this simple code that speaks for itself. <script language='javascript"> function check() {}
I have a simple code byte[] buffer = Encoding.UTF8.GetBytes(abracadabra); MemoryStream ms = new MemoryStream();
I have a simple code fragment in JS working with prototype inheritance. function object(o)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.