线程“main”中的异常org.hibernate.exception.SQLGrammarException:ORA-00917:缺少逗号

时间:2016-04-05 05:59:45

标签: java database hibernate

.fixed-menu

我的模特课在下面..

.fixed-menu {
    left:0;
    right:0;
    margin:0 auto;
    width: 95% // now you can change width and fixed element will be centered always
}
  

Class TwoWheel

package org.javab.hibernate;

import org.hibernate.Session; 
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.javab.Vehicle;
import org.javab.Twowheel;
import org.javab.Fourwheel;

public class Transport {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Twowheel Twowheel = new Twowheel();
        Twowheel.setTwowheel("two");
        Twowheel.setVehicleid(1);
        Twowheel.setVehiclename("bike and cycle");



        Fourwheel Fourwheel = new Fourwheel();  
        Fourwheel.setVehicleid(2);
        Fourwheel.setFourwheel("four");
        Fourwheel.setVehiclename("car and bus");

        Vehicle Vehicle = new Vehicle();
        Vehicle.setVehiclename("vehicle name");
        Vehicle.setVehicleid(3);



         @SuppressWarnings("deprecation")
        SessionFactory sessionfactory =new Configuration().configure().buildSessionFactory();
        Session session =sessionfactory.openSession();

      session.beginTransaction();   

      session.save(Vehicle);
      session.save(Fourwheel);
      session.save(Twowheel);
      session.getTransaction().commit();

      session.close();
    }

}
  

Class FourWheel

package org.javab;

import javax.persistence.*;

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
        name="vehicle d type",
        discriminatorType=DiscriminatorType.STRING)
public class Vehicle {
    @Id /*@GeneratedValue(strategy=GenerationType.AUTO,generator = "SEQ")
    @SequenceGenerator(name = "SEQ", sequenceName = "VEHICLE_SEQ", initialValue = 1)*/
    public int getVehicleid() {
        return vehicleid;
    }
    public void setVehicleid(int vehicleid) {
        this.vehicleid = vehicleid;
    }
    public String getVehiclename() {
        return vehiclename;
    }
    public void setVehiclename(String vehiclename) {
        this.vehiclename = vehiclename;
    }
    private int vehicleid;
        private String vehiclename;
}

我得到的package org.javab; import javax.persistence.Entity; @Entity public class Twowheel extends Vehicle { private String Twowheel; public String getTwowheel() { return Twowheel; } public void setTwowheel(String twowheel) { Twowheel = twowheel; } } 是......

package org.javab;

import javax.persistence.Entity;

@Entity
public class Fourwheel extends Vehicle{
private String fourwheel;

public String getFourwheel() {
    return fourwheel;
}

public void setFourwheel(String fourwheel) {
    this.fourwheel = fourwheel;
}
}
  

hibernate.cfg.xml中。

Exception

用10g方言和一切都很好, 还请帮我生成id ...我无法在oracle中生成id? 现在我只是硬编码,只是为了让它工作..

1 个答案:

答案 0 :(得分:0)

$scope.array2 = $filter('filter')(data, { type: '!1' }); 应该是列的名称。在您的情况下,名称为DiscriminatorColumn。并且不允许在列名中使用空格。

因此为"vehicle d type"使用一些合理的名称。请注意,此列必须存在于SQL表中。

另请注意,对于继承的类,您需要指定DiscriminatorColumn,以便hibernate可以区分它实际上是哪个类。