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 8289135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:26:23+00:00 2026-06-08T12:26:23+00:00

@SuppressWarnings(unchecked) //@Override public SerialNumber getCounter(String id) { Session cs = sessionFactory.getCurrentSession(); SerialNumber sn =

  • 0
@SuppressWarnings("unchecked")
//@Override
public SerialNumber getCounter(String id) {
    Session cs = sessionFactory.getCurrentSession();     
    SerialNumber sn = (SerialNumber) cs.get(SerialNumber.class, id);
    if (sn == null) {
        //TODO Throw an error (maybe). The code below creates a new Serial number counter
        log.debug("NO Serial Number for: " + id + " was found.");
        sn = new SerialNumber();
        sn.setSerialNumberId(id);
        sn.setName("Unspecified");
        sn.setValue(0);
    }
    sn.setValue(sn.getValue()+1);
    cs.saveOrUpdate(sn);
    cs.close();
    return sn;
}

This line is being ignored and saves nothing to the database (MySQL):

cs.saveOrUpdate(sn);

Any ideas as to why? I haven’t a clue.

I am by no means Java guru but even the Java guru here cannot figure it out. Any help will be appreciated.

Thanks.

  • 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-06-08T12:26:25+00:00Added an answer on June 8, 2026 at 12:26 pm

    It is possible that the updates are being deferred for the session. Try:

    cs.flush();
    

    If this is your problem, you can set this to AUTO in your properties:

    <prop key="org.hibernate.FlushMode">AUTO</prop>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class SettingsActivity extends SherlockPreferenceActivity implements OnSharedPreferenceChangeListener, OnPreferenceChangeListener { @SuppressWarnings(deprecation) @Override protected void onCreate(Bundle
When I cast to E[] (the class parameter), it requires me to add @SuppressWarnings(unchecked)
The following code public class GenericsTest2 { public static void main(String[] args) throws Exception
I'm trying to do the following: Class<?> cls = unknownClass; if(cls.isEnum()){ @SuppressWarnings(unchecked) Class<? extends
Sometime when looking through code, I see many methods specify an annotation: @SuppressWarnings(unchecked) What
have a peculiar problem with hibernate. I have a hibernate function like this. @SuppressWarnings(unchecked)
I want to make an Universal stack using generics . public class UniversalStack<E> implements
i am using following codes. addNewReceipt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {
public class AutoKeyMap<K,V> { public interface KeyGenerator<K> { public K generate(); } private KeyGenerator<K>
After I construct a hibernate query, my code goes as follows: @SuppressWarnings(unchecked) List<SendCommands> list

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.