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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:43:23+00:00 2026-06-02T23:43:23+00:00

I am getting java.sql.SQLException: The column ID in table METAL_HAREKET_IPTAL does not allow null

  • 0

I am getting “java.sql.SQLException: The column ID in table METAL_HAREKET_IPTAL does not allow null values.” on Sysbase database. However the value that I want to insert exists (you can see from the Tomcat’s log below)

metalhareket id: 450
metalhareketiptal id: 450
org.hibernate.exception.ConstraintViolationException: could not insert: [com.turktrust.iab.ebs.pojos.MetalHareketIptal]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
        at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
        at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
        at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
        at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
        at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
        at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
        at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
        at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
        at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
        at com.turktrust.iab.ebs.service.VirmanIptalOnayService.virmanIptal(VirmanIptalOnayService.java:239)
        at com.turktrust.iab.ebs.backingbeans.VirmanIptalOnayIslemleriBean.virmanIptal(VirmanIptalOnayIslemleriBean.java:101)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:772)
        at javax.faces.component.UICommand.broadcast(UICommand.java:300)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: The column ID in table METAL_HAREKET_IPTAL does not allow null values.

        at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybStatement.handleSQLE(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybStatement.updateLoop(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(Unknown Source)
        at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeUpdate(Unknown Source)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
        at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
        at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
        ... 48 more

Related code is as follows:

    System.out.println("metalhareket id: " + mh.getId().toString());
    session = HibernateUtil.getSessionFactory().openSession();
    tx = session.beginTransaction();
    mh.setDurum(EBSConstants.DURUM_BOOL_PASIF);

    session.update(mh);
    session.flush();

    Date d = new Date();

    MetalHareketIptal mhi = new MetalHareketIptal();
    mhi.setKullanici(kullanici);
    mhi.setMetalHareket(mh);
    mhi.setNeden(iptalNedeni);
    mhi.setTarih(d);
    mhi.setId(mh.getId());
    System.out.println("metalhareketiptal id: " + mhi.getId().toString());
    session.flush();
    session.save(mhi);

    Takas takas = mh.getTakas();
    BigDecimal geriMiktar = takas.getKalanMiktar().add(mh.getMiktar());
    takas.setKalanMiktar(geriMiktar);
    takas.setTakasDurum(EBSConstants.TAKAS_DURUM_AKTIF);

    session.update(takas);

EDIT:
related hibernate code for MetalHareket is:

<hibernate-mapping>
  <class name="com...MetalHareket" table="METAL_HAREKET">
    <id name="id" type="java.lang.Long">
      <column name="ID"/>
      <generator class="identity"/>
    </id>

pojo of MetalHareket:

public class MetalHareket implements java.io.Serializable {

    private Long id;
    public Long getId() {
        return this.id;
    }

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

hibernate mapping of metalheraketiptal:

   <hibernate-mapping>
      <class name="com....pojos.MetalHareketIptal" table="METAL_HAREKET_IPTAL">
        <id name="id" type="java.lang.Long">
          <column name="ID"/>
          <generator class="identity"/>
        </id>

pojo of metalhareketiptal:

public class MetalHareketIptal  implements java.io.Serializable {

private Long id;
 public Long getId() {
    return this.id;
}

public void setId(Long id) {
    this.id = id;
}
  • 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-02T23:43:25+00:00Added an answer on June 2, 2026 at 11:43 pm

    The problem with the above code was the hibernate file.
    Instead of this:

    <generator class="identity"/>
    

    supports identity columns in DB2, MySQL, MS SQL Server, Sybase and
    HypersonicSQL. The returned identifier is of type long, short or int.

    It should’ve been this:

    <generator class="assigned"/>
    

    In this case element do not generate the primary key and
    in Java it is required to set the primary key value before calling
    save() method.

    If you want the application to assign identifiers, as opposed to
    having Hibernate generate them, you can use the assigned generator.

    http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/mapping.html#mapping-declaration-id-enhanced-optimizers

    http://www.roseindia.net/hibernate/hibernateidgeneratorelement.shtml

    I was relying on Sybase to generate the ID column but then I was trying to set the ID element in my application, which of course does not make any sense.

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

Sidebar

Related Questions

I'm getting this exception java.sql.SQLException: Unknown column 'auyu' in 'where clause' My Query and
I'm currently getting the error: java.sql.SQLException: ORA-01843: not a valid month which I assume
I am currently getting the error, java.sql.SQLException: Method 'executeQuery(String)' not allowed on prepared statement.
Getting java.sql.SQLException java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6986) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at
I am getting the error: java.sql.SQLException: No suitable driver I have imported the .jar
I am getting the following error: java.sql.SQLException: Exhausted Resultset at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at
I'm getting the following excpetion: java.sql.SQLException: Protocol violation at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:286)
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Procedure 'STP_Insert_tblReceipt' expects parameter '@CPVFlag', which was not supplied.
I am getting this error when running a save insert/update command: SEVERE: null java.sql.SQLIntegrityConstraintViolationException:
Why do I keep getting this error: javax.servlet.ServletException: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00904: PURCHASE_PRICE: invalid identifier As

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.