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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:19:54+00:00 2026-05-23T14:19:54+00:00

I have a problem with Hibernate. When I want to save an object into

  • 0

I have a problem with Hibernate. When I want to save an object into database, I get this exception:

org.hibernate.exception.GenericJDBCException: could not get next sequence value
25P02, current transaction is aborted, commands ignored until end of transaction block

My hibernate configuration file is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <!-- Database connection settings -->
  <property name="connection.driver_class">org.postgresql.Driver</property>
  <property name="connection.url">jdbc:postgresql://localhost:5432/3encult</property>
  <property name="connection.username">3encult</property>
  <property name="connection.password">3encult</property>
  <!-- JDBC connection pool (use the built-in) -->
  <property name="connection.pool_size">10</property>
  <!-- SQL dialect -->
  <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  <!-- Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">thread</property>
  <!-- Disable the second-level cache  
  Echo all executed SQL to stdout -->
  <property name="show_sql">true</property>
  <!-- Drop and re-create the database schema on startup 
    <property name="hbm2ddl.auto">create</property>-->
  <mapping resource="resources/User.hbm.xml"/>
  <mapping resource="resources/ApplicationField.hbm.xml"/>
  <mapping resource="resources/Attribute.hbm.xml"/>
  <mapping resource="resources/Device.hbm.xml"/>
  <mapping resource="resources/Role.hbm.xml"/>
  </session-factory>
</hibernate-configuration>

And my Hibernate mapping file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                               "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 07-abr-2011 13:29:19 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
 <class name="com.cartif.database.Attribute" table="Attribute">
  <id name="iAttrId" column="attributeid" type="java.lang.Integer">
  <generator class="native">
    <param name="sequence">s_attribute</param>
  </generator>
</id>
 <property column="name" generated="never" lazy="false" name="name" type="java.lang.String"/>
 <property column="value" generated="never" lazy="false" name="value" type="java.lang.String"/>
 <property column="timestamp" generated="never" lazy="false" name="date" type="java.sql.Timestamp"/>
 <property column="deviceId" generated="never" lazy="false" name="iDeviceId" type="java.lang.Integer"/>
 <property column="sensorId" generated="never" lazy="false" name="iSensorId" type="java.lang.Integer"/>
 </class>
</hibernate-mapping>

The attribute iAttrId exists and it has get/set methods and column attributeid on table Attribute also exists.

Hibernate shows the SQL querys, and they are:

Hibernate: select nextval ('s_attribute')
Hibernate: insert into Attribute (name, value, timestamp, deviceId, sensorId, attributeid) values (?, ?, ?, ?, ?, ?)

What is the cause?

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-05-23T14:19:55+00:00Added an answer on May 23, 2026 at 2:19 pm

    I have deleted previous sequence and generated a new sequence and it works fine!

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

Sidebar

Related Questions

my problem is that, i want to save class object java.lang.reflect.Field into database using
I have problem when want read object with where (double variable) this is my
I'm quite new to hibernate and have stumbled on this problem, which I can't
I have a problem with: NHibernate.Cfg.Configuration.SetProperties() Not accepting the IDictionary: NHibernateConfigHandler I get the
This is a real beginner Hibernate problem. I have a problem with the mappings
I'm currently learning Hibernate, and I've stumbled into this issue: I have defined 3
I do not want to have the hibernate.cfg.xml file. Rather I want to do
I have an odd problem where Hibernate is running more queries than I've asked
I have a problem with a query using hibernate. The entity class EntityClass has
I have a jar on the classpath which contains a hibernate.properties. This causes problems

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.