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

  • SEARCH
  • Home
  • 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 550555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:18:02+00:00 2026-05-13T11:18:02+00:00

I was doing simple things with hibernate, as I have to learn it for

  • 0

I was doing simple things with hibernate, as I have to learn it for a project. I created this simple example:

package hibtests;

import hibtests.beans.newBean;
import org.hibernate.Session;

/**
 *
 * @author dario
 */
public class Main {


    public void test(){
        Session session = NewHibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();

        newBean nb = new newBean();
        nb.setNome("FooFoo");
        session.save(nb);

        session.getTransaction().commit();

    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Main main = new Main();
        main.test();
    }

}

…and it was working fine, putting rows in the db. Then I worked on another class for a couple of hours. I try this example again and Hibernate makes this strange query:

Hibernate: 
    insert 
    into
        TEST
        (ID, NOME) 
    values
        (default, ?)
Hibernate: 

values
    identity_val_local()

like it just can’t read the property that is FooFoo. I checked if I changed the source… but it is not the case. Everything is just like before and there are not exceptions. The newBean instance is not null and FooFoo is in the Nome field. Why this?

Oh, I forgot, I’m using Netbeans 6.8 and JavaDB.

As requested, my mapping follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="hibtests.beans.newBean" table="APP.TEST">
        <id name="id" column="ID">
           <generator class="identity"/>
        </id>
        <property name="nome" column="NOME" type="string"/>
    </class>
</hibernate-mapping>

Last minute update: turns out that insertion is working. Anyway I can still see the query with a ? instead of the string. Why?


As requested newbean source code follows:

public class newBean {

Long id;

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getNome() {
    return nome;
}

public void setNome(String nome) {
    this.nome = nome;
}
String nome;

}

  • 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-13T11:18:03+00:00Added an answer on May 13, 2026 at 11:18 am

    You will never see the value of the strings being inserted in the DB, you will always see them as question marks (?) there are sniffers that will show their contents, but in standard hibernate you will not see any values.

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

Sidebar

Related Questions

I'm doing some simple tests (in preparation for a larger project) to call an
What am I doing wrong? I have a simple console app in VS08. When
I'm doing simple string input parsing and I am in need of a string
I am doing simple forms authentication for a small ASP.NET (3.5, C#) application and
When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char)
I am doing some simple sanity validation on various types. The current test I'm
So, I'm doing a simple scan to get a list of all folders on
I'm doing some really simple math and saving the result to a MS SQL2008
I'm doing something really simple: slurping an entire text file from disk into a
Simple question, hopefully an easy way and just want to verify I'm doing it

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.