Calisan.java

package deneme2;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "CALISAN")
public class Calisan {
    @Id
    @SequenceGenerator(allocationSize = 1, name = "seqCalisan", sequenceName = "SEQ_CALISAN")
    @GeneratedValue(generator = "seqCalisan", strategy = GenerationType.SEQUENCE)
    int field_id;
    int form_id;
    String field_tag_id;
    String field_type;
    String field_name;
    String field_version;
    String field_status;
    String field_mandatory;
    String field_parent_tag_id;
    int field_column_id;
    String field_attribute;
    String field_has_lookup;
    String created_date;
    String updated_date;
    @ManyToOne
    @JoinColumn(name = "form_id2")
    private Mahalle form_def;

public Calisan(){
    }

@Override
    public String toString() {
        return "Calisan [field_id=" + field_id + ", form_id=" + form_id + ", field_tag_id=" + field_tag_id
                + ", field_type=" + field_type + ", field_name=" + field_name + ", field_version=" + field_version
                + ", field_status=" + field_status + ", field_mandatory=" + field_mandatory + ", field_parent_tag_id="
                + field_parent_tag_id + ", field_column_id=" + field_column_id + ", field_attribute=" + field_attribute
                + ", field_has_lookup=" + field_has_lookup + ", created_date=" + created_date + ", updated_date="
                + updated_date + ", form_def=" + form_def + "]";
    }

public Calisan(int field_id, int form_id, String field_tag_id, String field_type, String field_name,
            String field_version, String field_status, String field_mandatory, String field_parent_tag_id,
            int field_column_id, String field_attribute, String field_has_lookup, String created_date,
            String updated_date, Mahalle form_def) {
        super();
        this.field_id = field_id;
        this.form_id = form_id;
        this.field_tag_id = field_tag_id;
        this.field_type = field_type;
        this.field_name = field_name;
        this.field_version = field_version;
        this.field_status = field_status;
        this.field_mandatory = field_mandatory;
        this.field_parent_tag_id = field_parent_tag_id;
        this.field_column_id = field_column_id;
        this.field_attribute = field_attribute;
        this.field_has_lookup = field_has_lookup;
        this.created_date = created_date;
        this.updated_date = updated_date;
        this.form_def = form_def;
    }

public int getField_id() {
        return field_id;
    }

public void setField_id(int field_id) {
        this.field_id = field_id;
    }

public int getForm_id() {
        return form_id;
    }

public void setForm_id(int form_id) {
        this.form_id = form_id;
    }

public String getField_tag_id() {
        return field_tag_id;
    }

public void setField_tag_id(String field_tag_id) {
        this.field_tag_id = field_tag_id;
    }

public String getField_type() {
        return field_type;
    }

public void setField_type(String field_type) {
        this.field_type = field_type;
    }

public String getField_name() {
        return field_name;
    }

public void setField_name(String field_name) {
        this.field_name = field_name;
    }

public String getField_version() {
        return field_version;
    }

public void setField_version(String field_version) {
        this.field_version = field_version;
    }

public String getField_status() {
        return field_status;
    }

public void setField_status(String field_status) {
        this.field_status = field_status;
    }

public String getField_mandatory() {
        return field_mandatory;
    }

public void setField_mandatory(String field_mandatory) {
        this.field_mandatory = field_mandatory;
    }

public String getField_parent_tag_id() {
        return field_parent_tag_id;
    }

public void setField_parent_tag_id(String field_parent_tag_id) {
        this.field_parent_tag_id = field_parent_tag_id;
    }

public int getField_column_id() {
        return field_column_id;
    }

public void setField_column_id(int field_column_id) {
        this.field_column_id = field_column_id;
    }

public String getField_attribute() {
        return field_attribute;
    }

public void setField_attribute(String field_attribute) {
        this.field_attribute = field_attribute;
    }

public String getField_has_lookup() {
        return field_has_lookup;
    }

public void setField_has_lookup(String field_has_lookup) {
        this.field_has_lookup = field_has_lookup;
    }

public String getCreated_date() {
        return created_date;
    }

public void setCreated_date(String created_date) {
        this.created_date = created_date;
    }

public String getUpdated_date() {
        return updated_date;
    }

public void setUpdated_date(String updated_date) {
        this.updated_date = updated_date;
    }

public Mahalle getForm_def() {
        return form_def;
    }

public void setForm_def(Mahalle form_def) {
        this.form_def = form_def;
    }

}

Mahalle.java

package deneme2;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "MAHALLE")
public class Mahalle {
    @Id
    @SequenceGenerator(allocationSize = 1, name = "seqMahalle", sequenceName = "SEQ_MAHALLE")
    @GeneratedValue(generator = "seqMahalle", strategy = GenerationType.SEQUENCE)
    private int form_id;
    private String form_name;
    private String form_mode;
    private String created_date;
    private String updated_date;

public Mahalle(){
    }
    public int getForm_id() {
        return form_id;
    }
    public void setForm_id(int form_id) {
        this.form_id = form_id;
    }
    public String getForm_name() {
        return form_name;
    }
    public void setForm_name(String form_name) {
        this.form_name = form_name;
    }
    public String getForm_mode() {
        return form_mode;
    }
    public void setForm_mode(String form_mode) {
        this.form_mode = form_mode;
    }
    public String getCreated_date() {
        return created_date;
    }
    public void setCreated_date(String created_date) {
        this.created_date = created_date;
    }
    public String getUpdated_date() {
        return updated_date;
    }
    public void setUpdated_date(String updated_date) {
        this.updated_date = updated_date;
    }
    @Override
    public String toString() {
        return "Mahalle [form_id=" + form_id + ", form_name=" + form_name + ", form_mode=" + form_mode
                + ", created_date=" + created_date + ", updated_date=" + updated_date + "]";
    }
    public Mahalle(int form_id, String form_name, String form_mode, String created_date, String updated_date) {
        super();
        this.form_id = form_id;
        this.form_name = form_name;
        this.form_mode = form_mode;
        this.created_date = created_date;
        this.updated_date = updated_date;
    }

}

Aldığım hata:


    Ağu 21, 2015 3:58:43 PM org.hibernate.envers.boot.internal.EnversServiceImpl configure
    INFO: Envers integration enabled? : true
    Ağu 21, 2015 3:58:44 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000228: Running hbm2ddl schema update
    Hibernate: select next value for SEQ_MAHALLE
    Hibernate: insert into MAHALLE (created_date, form_mode, form_name, updated_date, form_id) values (?, ?, ?, ?, ?)
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    WARN: SQL Error: 515, SQLState: 23000
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    ERROR: Cannot insert the value NULL into column 'ID', table 'veritabanim.dbo.MAHALLE'; column does not allow nulls. INSERT fails.
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release
    INFO: HHH000010: On release of batch it still contained JDBC statements
    Ağu 21, 2015 3:58:44 PM org.hibernate.internal.SessionImpl$5 mapManagedFlushFailure
    ERROR: HHH000346: Error during managed flush [could not execute statement]
    Exception while persisting:could not execute statement
    Hibernate: select next value for SEQ_CALISAN
    Hibernate: insert into CALISAN (created_date, field_attribute, field_column_id, field_has_lookup, field_mandatory, field_name, field_parent_tag_id, field_status, field_tag_id, field_type, field_version, form_id2, form_id, updated_date, field_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    WARN: SQL Error: 515, SQLState: 23000
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    ERROR: Cannot insert the value NULL into column 'ID', table 'veritabanim.dbo.CALISAN'; column does not allow nulls. INSERT fails.
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release
    INFO: HHH000010: On release of batch it still contained JDBC statements
    Ağu 21, 2015 3:58:44 PM org.hibernate.internal.SessionImpl$5 mapManagedFlushFailure
    ERROR: HHH000346: Error during managed flush [could not execute statement]
    Exception while persisting:could not execute statement
    Hibernate: select next value for SEQ_CALISAN
    Hibernate: insert into CALISAN (created_date, field_attribute, field_column_id, field_has_lookup, field_mandatory, field_name, field_parent_tag_id, field_status, field_tag_id, field_type, field_version, form_id2, form_id, updated_date, field_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    WARN: SQL Error: 515, SQLState: 23000
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    ERROR: Cannot insert the value NULL into column 'ID', table 'veritabanim.dbo.CALISAN'; column does not allow nulls. INSERT fails.
    Ağu 21, 2015 3:58:44 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release
    INFO: HHH000010: On release of batch it still contained JDBC statements
    Ağu 21, 2015 3:58:44 PM org.hibernate.internal.SessionImpl$5 mapManagedFlushFailure
    ERROR: HHH000346: Error during managed flush [could not execute statement]
    Exception while persisting:could not execute statement

Sebebini çözemedim bir türlü 1 haftadır. Yardımcı olabilcek var mı acaba?

soruldu: 21 Ağu '15, 09:00

mow's gravatar image

mow
0557
cevap kabul oranı: 0%

değiştirildi: 03 Eyl '15, 11:52

CemIkta's gravatar image

CemIkta ♦
19.9k29125190


Anladığım kadarıyla Id'ler generate edilmiyor.

@Id @SequenceGenerator(allocationSize = 1, name = "seqCalisan", 
      sequenceName = "SEQ_CALISAN") 
@GeneratedValue(generator = "seqCalisan", 
      strategy = GenerationType.SEQUENCE) int field_id;

Satırlarını kontrol et.

@Id
@GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)

şeklinde deneyebilirsin.

permanent link

cevaplandı: 02 Eyl '15, 06:06

SaRPaRDa's gravatar image

SaRPaRDa
5.0k213165
cevap kabul oranı: 27%

Cevabınız
toggle preview

Bu soruyu takip et

E-Posta üzerinden:

Üyelik girişi yaptıktan sonra abonelik işlemlerini yapabilirsiniz

RSS üzerinden:

Cevaplar

Cevaplar ve Yorumlar

Yazı Formatlama

  • *italic* ya da _italic_
  • **bold** ya da __bold__
  • link:[text](http://url.com/ "başlık")
  • resim?![alt text](/path/img.jpg "başlık")
  • liste: 1. Foo 2. Bar
  • temel HTML etiketleri de kullanılabilir

Bu sorunun etiketleri:

×109

Soruldu: 21 Ağu '15, 09:00

Görüntüleme: 595 kez

Son güncelleme: 03 Eyl '15, 11:52

powered by BitNami OSQA