[jboss-jira] [JBoss JIRA] (HIBERNATE-140) Does not recreate all tables for MySql database
Nikola Vulovic (JIRA)
jira-events at lists.jboss.org
Sat Sep 22 14:40:34 EDT 2012
[ https://issues.jboss.org/browse/HIBERNATE-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikola Vulovic resolved HIBERNATE-140.
--------------------------------------
Resolution: Done
I have deleted @table and @namedquerries from entities, after that i renamed field from index to indeks on entity student and everithing works as it is suppose to.
> Does not recreate all tables for MySql database
> -----------------------------------------------
>
> Key: HIBERNATE-140
> URL: https://issues.jboss.org/browse/HIBERNATE-140
> Project: Hibernate Integration
> Issue Type: Bug
> Environment: Ubuntu 12.04, Netbeans 7.1.2, apache-tomcat-7.0.30, mysql Ver 14.14 Distrib 5.5.24, for debian-linux-gnu (x86_64) using readline 6.2, Hibernate 4.1.7 final,Hibernate 3.6.0 final, tapestry 5.2.6
> Reporter: Nikola Vulovic
> Assignee: Steve Ebersole
> Priority: Critical
> Labels: hibernate
>
> I am trying to make a tapestry project in Netbeans with hibernate as database framework 3.6.0 final for Faculty Project. The upgrade to 4.1.7 did not help.
> This is what log apache in netbeans output shows:
> Sep 21, 2012 4:17:57 AM org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
> Sep 21, 2012 4:17:58 AM org.apache.coyote.AbstractProtocol init
> INFO: Initializing ProtocolHandler ["http-bio-8080"]
> Sep 21, 2012 4:17:58 AM org.apache.coyote.AbstractProtocol init
> INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
> Sep 21, 2012 4:17:58 AM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 1408 ms
> Sep 21, 2012 4:17:58 AM org.apache.catalina.core.StandardService startInternal
> INFO: Starting service Catalina
> Sep 21, 2012 4:17:58 AM org.apache.catalina.core.StandardEngine startInternal
> INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
> Sep 21, 2012 4:17:58 AM org.apache.catalina.startup.HostConfig deployDescriptor
> INFO: Deploying configuration descriptor /home/nikola/apache-tomcat-7.0.30/conf/Catalina/localhost/nkv850.xml
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory /home/nikola/apache-tomcat-7.0.30/webapps/examples
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory /home/nikola/apache-tomcat-7.0.30/webapps/ROOT
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory /home/nikola/apache-tomcat-7.0.30/webapps/docs
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory /home/nikola/apache-tomcat-7.0.30/webapps/host-manager
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory /home/nikola/apache-tomcat-7.0.30/webapps/manager
> Sep 21, 2012 4:18:04 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["http-bio-8080"]
> Sep 21, 2012 4:18:04 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["ajp-bio-8009"]
> Sep 21, 2012 4:18:04 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 6228 ms
> 04:18:10,169 INFO Version:37 - Hibernate Commons Annotations 3.2.0.Final
> 04:18:10,221 INFO Environment:593 - Hibernate 3.6.0.Final
> 04:18:10,225 INFO Environment:626 - hibernate.properties not found
> 04:18:10,241 INFO Environment:804 - Bytecode provider name : javassist
> 04:18:10,329 INFO Environment:685 - using JDK 1.4 java.sql.Timestamp handling
> 04:18:10,425 INFO Configuration:2126 - configuring from resource: /hibernate.cfg.xml
> 04:18:10,425 INFO Configuration:2145 - Configuration resource: /hibernate.cfg.xml
> 04:18:10,473 WARN DTDEntityResolver:73 - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
> 04:18:10,521 INFO Configuration:2267 - Configured SessionFactory: null
> 04:18:10,525 INFO Configuration:815 - Mapping package projekat.entities
> 04:18:10,565 WARN AnnotationBinder:263 - Package not found or wo package-info.java: projekat.entities
> 04:18:10,625 INFO AnnotationBinder:532 - Binding entity from annotated class: projekat.entities.Grupa
> 04:18:10,649 INFO QueryBinder:86 - Binding Named query: Grupa.findAll => SELECT g FROM Grupa g
> 04:18:10,649 INFO QueryBinder:86 - Binding Named query: Grupa.findByKljuc => SELECT g FROM Grupa g WHERE g.kljuc = :kljuc
> 04:18:10,653 INFO QueryBinder:86 - Binding Named query: Grupa.findByBroj => SELECT g FROM Grupa g WHERE g.broj = :broj
> 04:18:10,653 INFO QueryBinder:86 - Binding Named query: Grupa.findByVrstaPredavanja => SELECT g FROM Grupa g WHERE g.vrstaPredavanja = :vrstaPredavanja
> 04:18:10,685 INFO EntityBinder:519 - Bind entity projekat.entities.Grupa on table Grupa
> 04:18:10,813 INFO AnnotationBinder:532 - Binding entity from annotated class: projekat.entities.Korisnik
> 04:18:10,813 INFO QueryBinder:86 - Binding Named query: Korisnik.findAll => SELECT k FROM Korisnik k
> 04:18:10,817 INFO QueryBinder:86 - Binding Named query: Korisnik.findByKljuc => SELECT k FROM Korisnik k WHERE k.kljuc = :kljuc
> 04:18:10,825 INFO QueryBinder:86 - Binding Named query: Korisnik.findByNalog => SELECT k FROM Korisnik k WHERE k.nalog = :nalog
> 04:18:10,829 INFO QueryBinder:86 - Binding Named query: Korisnik.findByLozinka => SELECT k FROM Korisnik k WHERE k.lozinka = :lozinka
> 04:18:10,833 INFO QueryBinder:86 - Binding Named query: Korisnik.findByRola => SELECT k FROM Korisnik k WHERE k.rola = :rola
> 04:18:10,837 INFO EntityBinder:519 - Bind entity projekat.entities.Korisnik on table Korisnik
> 04:18:10,845 INFO AnnotationBinder:532 - Binding entity from annotated class: projekat.entities.Predmet
> 04:18:10,845 INFO QueryBinder:86 - Binding Named query: Predmet.findAll => SELECT p FROM Predmet p
> 04:18:10,849 INFO QueryBinder:86 - Binding Named query: Predmet.findByKljuc => SELECT p FROM Predmet p WHERE p.kljuc = :kljuc
> 04:18:10,849 INFO QueryBinder:86 - Binding Named query: Predmet.findByNaziv => SELECT p FROM Predmet p WHERE p.naziv = :naziv
> 04:18:10,853 INFO QueryBinder:86 - Binding Named query: Predmet.findBySifra => SELECT p FROM Predmet p WHERE p.sifra = :sifra
> 04:18:10,853 INFO QueryBinder:86 - Binding Named query: Predmet.findByGranica => SELECT p FROM Predmet p WHERE p.granica = :granica
> 04:18:10,853 INFO EntityBinder:519 - Bind entity projekat.entities.Predmet on table Predmet
> 04:18:10,865 INFO AnnotationBinder:532 - Binding entity from annotated class: projekat.entities.Student
> 04:18:10,869 INFO QueryBinder:86 - Binding Named query: Student.findAll => SELECT s FROM Student s
> 04:18:10,869 INFO QueryBinder:86 - Binding Named query: Student.findByKljuc => SELECT s FROM Student s WHERE s.kljuc = :kljuc
> 04:18:10,869 INFO QueryBinder:86 - Binding Named query: Student.findByIme => SELECT s FROM Student s WHERE s.ime = :ime
> 04:18:10,877 INFO QueryBinder:86 - Binding Named query: Student.findByPrezime => SELECT s FROM Student s WHERE s.prezime = :prezime
> 04:18:10,877 INFO QueryBinder:86 - Binding Named query: Student.findByIndex => SELECT s FROM Student s WHERE s.index = :index
> 04:18:10,881 INFO EntityBinder:519 - Bind entity projekat.entities.Student on table Student
> 04:18:10,897 INFO CollectionBinder:745 - Mapping collection: projekat.entities.Predmet.grupaList -> Grupa
> 04:18:10,905 INFO Configuration:1646 - Hibernate Validator not found: ignoring
> 04:18:10,917 INFO HibernateSearchEventListenerRegister:75 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
> 04:18:10,929 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
> 04:18:10,929 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 5
> 04:18:10,929 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
> 04:18:10,933 INFO DriverManagerConnectionProvider:103 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/1234
> 04:18:10,937 INFO DriverManagerConnectionProvider:109 - connection properties: {autoReconnect=true, user=root, password=****, autoReconnectForPools=true}
> 04:18:11,185 INFO SettingsFactory:117 - Database ->
> name : MySQL
> version : 5.5.24-0ubuntu0.12.04.1
> major : 5
> minor : 5
> 04:18:11,189 INFO SettingsFactory:123 - Driver ->
> name : MySQL-AB JDBC Driver
> version : mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
> major : 5
> minor : 1
> 04:18:11,213 INFO Dialect:108 - Using dialect: org.hibernate.dialect.MySQLDialect
> 04:18:11,229 INFO JdbcSupportLoader:79 - Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
> 04:18:11,233 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
> 04:18:11,237 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
> 04:18:11,241 INFO SettingsFactory:179 - Automatic flush during beforeCompletion(): enabled
> 04:18:11,241 INFO SettingsFactory:183 - Automatic session close at end of transaction: disabled
> 04:18:11,253 INFO SettingsFactory:190 - JDBC batch size: 15
> 04:18:11,253 INFO SettingsFactory:193 - JDBC batch updates for versioned data: disabled
> 04:18:11,265 INFO SettingsFactory:198 - Scrollable result sets: enabled
> 04:18:11,265 INFO SettingsFactory:206 - JDBC3 getGeneratedKeys(): enabled
> 04:18:11,265 INFO SettingsFactory:214 - Connection release mode: auto
> 04:18:11,269 INFO SettingsFactory:238 - Maximum outer join fetch depth: 2
> 04:18:11,269 INFO SettingsFactory:241 - Default batch fetch size: 1
> 04:18:11,269 INFO SettingsFactory:245 - Generate SQL with comments: enabled
> 04:18:11,269 INFO SettingsFactory:249 - Order SQL updates by primary key: disabled
> 04:18:11,269 INFO SettingsFactory:253 - Order SQL inserts for batching: disabled
> 04:18:11,273 INFO SettingsFactory:431 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
> 04:18:11,273 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
> 04:18:11,285 INFO SettingsFactory:261 - Query language substitutions: {}
> 04:18:11,285 INFO SettingsFactory:266 - JPA-QL strict compliance: disabled
> 04:18:11,285 INFO SettingsFactory:271 - Second-level cache: enabled
> 04:18:11,285 INFO SettingsFactory:275 - Query cache: disabled
> 04:18:11,289 INFO SettingsFactory:406 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
> 04:18:11,289 INFO SettingsFactory:285 - Optimize cache for minimal puts: disabled
> 04:18:11,289 INFO SettingsFactory:294 - Structured second-level cache entries: disabled
> 04:18:11,305 INFO SettingsFactory:314 - Echoing all SQL to stdout
> 04:18:11,321 INFO SettingsFactory:323 - Statistics: enabled
> 04:18:11,321 INFO SettingsFactory:327 - Deleted entity synthetic identifier rollback: disabled
> 04:18:11,321 INFO SettingsFactory:343 - Default entity-mode: pojo
> 04:18:11,325 INFO SettingsFactory:347 - Named query checking : enabled
> 04:18:11,325 INFO SettingsFactory:351 - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
> 04:18:11,385 INFO SessionFactoryImpl:200 - building session factory
> 04:18:11,613 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
> 04:18:12,065 ERROR SchemaExport:386 - Unsuccessful: create table 1234.Grupa (kljuc bigint not null auto_increment, broj integer not null, vrstaPredavanja varchar(255) not null, Predmet_kljuc bigint not null, primary key (kljuc))
> 04:18:12,065 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Grupa (kljuc bigint not null auto_increment, broj integer not null, vrstaPr' at line 1
> 04:18:12,065 ERROR SchemaExport:386 - Unsuccessful: create table 1234.Korisnik (kljuc bigint not null auto_increment, lozinka varchar(255) not null, nalog varchar(255) not null, rola varchar(255) not null, primary key (kljuc))
> 04:18:12,065 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Korisnik (kljuc bigint not null auto_increment, lozinka varchar(255) not nu' at line 1
> 04:18:12,073 ERROR SchemaExport:386 - Unsuccessful: create table 1234.Predmet (kljuc bigint not null auto_increment, granica integer not null, naziv varchar(255) not null, sifra varchar(255) not null, primary key (kljuc))
> 04:18:12,073 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Predmet (kljuc bigint not null auto_increment, granica integer not null, na' at line 1
> 04:18:12,073 ERROR SchemaExport:386 - Unsuccessful: create table 1234.Student (kljuc bigint not null auto_increment, ime varchar(255) not null, index integer not null, prezime varchar(255) not null, primary key (kljuc))
> 04:18:12,081 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Student (kljuc bigint not null auto_increment, ime varchar(255) not null, i' at line 1
> 04:18:12,181 ERROR SchemaExport:386 - Unsuccessful: alter table 1234.Grupa add index FK41E1C3B2E7E33D9 (Predmet_kljuc), add constraint FK41E1C3B2E7E33D9 foreign key (Predmet_kljuc) references 1234.Predmet (kljuc)
> 04:18:12,181 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Grupa add index FK41E1C3B2E7E33D9 (Predmet_kljuc), add constraint FK41E1C3B' at line 1
> 04:18:12,181 ERROR SchemaExport:386 - Unsuccessful: alter table Grupa_Student add index FK2DCE7217EA5664B7 (studentList_kljuc), add constraint FK2DCE7217EA5664B7 foreign key (studentList_kljuc) references 1234.Student (kljuc)
> 04:18:12,185 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Student (kljuc)' at line 1
> 04:18:12,185 ERROR SchemaExport:386 - Unsuccessful: alter table Grupa_Student add index FK2DCE721749EEF319 (Grupa_kljuc), add constraint FK2DCE721749EEF319 foreign key (Grupa_kljuc) references 1234.Grupa (kljuc)
> 04:18:12,185 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Grupa (kljuc)' at line 1
> 04:18:12,185 ERROR SchemaExport:386 - Unsuccessful: alter table Student_Grupa add index FKA7E5917FF7A9819 (Student_kljuc), add constraint FKA7E5917FF7A9819 foreign key (Student_kljuc) references 1234.Student (kljuc)
> 04:18:12,185 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Student (kljuc)' at line 1
> 04:18:12,189 ERROR SchemaExport:386 - Unsuccessful: alter table Student_Grupa add index FKA7E59176004AFB7 (grupaList_kljuc), add constraint FKA7E59176004AFB7 foreign key (grupaList_kljuc) references 1234.Grupa (kljuc)
> 04:18:12,189 ERROR SchemaExport:387 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234.Grupa (kljuc)' at line 1
> This is hibernate.cfg.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Author: Mateja Opačić -->
> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
> <hibernate-configuration>
> <session-factory>
> <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
> <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
> <property name="connection.url">jdbc:mysql://localhost/1234</property>
> <!--?autoReconnect=true-->
> <property name="connection.username">root</property>
> <property name="connection.password">1234</property>
> <property name="connection.autoReconnectForPools">true</property>
> <property name="connection.autoReconnect">true</property>
> <property name="connection.pool_size">5</property>
> <property name="hbm2ddl.auto">create</property>
> <!-- Print SQL to stdout. -->
> <property name="show_sql">true</property>
> <property name="format_sql">true</property>
> <property name="use_sql_comments">true</property>
> <property name="generate_statistics">true</property>
> <property name="hibernate.transaction.flush_before_completion">true</property>
> <!-- Mapping files -->
> <mapping class="projekat.entities.Predmet"/>
> <mapping class="projekat.entities.Grupa"/>
> <mapping class="projekat.entities.Student"/>
> <mapping class="projekat.entities.Korisnik"/>
> </session-factory>
> </hibernate-configuration>
> This is presistence.xml since I imported entities from database and edited them in netbeans:
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
> <persistence-unit name="IT250_ProjekatPU" transaction-type="RESOURCE_LOCAL">
> <provider>org.hibernate.ejb.HibernatePersistence</provider>
> <class>projekat.entities.Student</class>
> <class>projekat.entities.Predmet</class>
> <class>projekat.entities.Grupa</class>
> <class>projekat.entities.Korisnik</class>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
> <properties>
> <property name="hibernate.connection.username" value="root"/>
> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
> <property name="hibernate.connection.password" value="1234"/>
> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/1234"/>
> <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
> </properties>
> </persistence-unit>
> </persistence>
> Predmet has one to many relationship Grupa, Grupa has many to many relationship to Student
> Korisnik is table for its own.
> All that is recreated in MySql database are table named
> Grupa_Student and Student_Grupa for many to many relationships
> This is a sample of entity Grupa reedited after being imported from MySQL database
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
> package projekat.entities;
> import java.io.Serializable;
> import java.util.List;
> import java.util.Objects;
> import javax.persistence.*;
> import org.apache.tapestry5.beaneditor.NonVisual;
> /**
> *
> * @author nikola
> */
> @Entity
> @Table(name = "Grupa", catalog = "1234", schema = "")
> @NamedQueries({
> @NamedQuery(name = "Grupa.findAll",
> query = "SELECT g FROM Grupa g"),
> @NamedQuery(name = "Grupa.findByKljuc",
> query = "SELECT g FROM Grupa g WHERE g.kljuc = :kljuc"),
> @NamedQuery(name = "Grupa.findByBroj",
> query = "SELECT g FROM Grupa g WHERE g.broj = :broj"),
> @NamedQuery(name = "Grupa.findByVrstaPredavanja",
> query = "SELECT g FROM Grupa g WHERE g.vrstaPredavanja = :vrstaPredavanja")})
> public class Grupa implements Serializable {
> private static final long serialVersionUID = 1L;
> @Id
> @NonVisual
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> @Basic(optional = false)
> @Column(name = "kljuc", nullable = false,length = 20)
> private Long kljuc;
> @Basic(optional = false)
> @Column(name = "broj", nullable = false,length = 10)
> private int broj;
> @Basic(optional = false)
> @Column(name = "vrstaPredavanja", nullable = false, length = 255)
> @Enumerated(EnumType.STRING)
> private TipPredavanja vrstaPredavanja;
> @ManyToMany
> private List<Student> studentList;
> @JoinColumn(name = "Predmet_kljuc", referencedColumnName = "kljuc", nullable = false)
> @ManyToOne(optional = false, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
> private Predmet predmetkljuc;
> public Grupa() {
> }
> public Long getKljuc() {
> return kljuc;
> }
> public void setKljuc(Long kljuc) {
> this.kljuc = kljuc;
> }
> public int getBroj() {
> return broj;
> }
> public void setBroj(int broj) {
> this.broj = broj;
> }
> public TipPredavanja getVrstaPredavanja() {
> return vrstaPredavanja;
> }
> public void setVrstaPredavanja(TipPredavanja vrstaPredavanja) {
> this.vrstaPredavanja = vrstaPredavanja;
> }
> public List<Student> getStudentList() {
> return studentList;
> }
> public void setStudentList(List<Student> studentList) {
> this.studentList = studentList;
> }
> public Predmet getPredmetkljuc() {
> return predmetkljuc;
> }
> public void setPredmetkljuc(Predmet predmetkljuc) {
> this.predmetkljuc = predmetkljuc;
> }
> @Override
> public boolean equals(Object obj) {
> if (obj == null) {
> return false;
> }
> if (getClass() != obj.getClass()) {
> return false;
> }
> final Grupa other = (Grupa) obj;
> if (!Objects.equals(this.kljuc, other.kljuc)) {
> return false;
> }
> if (this.broj != other.broj) {
> return false;
> }
> if (!Objects.equals(this.vrstaPredavanja, other.vrstaPredavanja)) {
> return false;
> }
> return true;
> }
> @Override
> public int hashCode() {
> int hash = 7;
> hash = 59 * hash + Objects.hashCode(this.kljuc);
> hash = 59 * hash + this.broj;
> hash = 59 * hash + Objects.hashCode(this.vrstaPredavanja);
> return hash;
> }
> @Override
> public String toString() {
> return "Grupa{" + "broj=" + broj + ", vrstaPredavanja=" + vrstaPredavanja + '}';
> }
> }
> I truly do not why hibernate fails to make the table in MySQL database.
> One thing I have noticed in the log at 04:18:12,065 point hibernate says it
> Unsuccessful: create table 1234.Grupa (kljuc bigint not null auto_increment, broj integer not null, vrstaPredavanja varchar(255) not null, Predmet_kljuc bigint not null, primary key (kljuc))
> This is sql for creating entity Grupa not edited in Netbeans made by MySQL workbench
> looks like this:
> -- -----------------------------------------------------
> -- Table `1234`.`Grupa`
> -- -----------------------------------------------------
> DROP TABLE IF EXISTS `1234`.`Grupa` ;
> SHOW WARNINGS;
> CREATE TABLE IF NOT EXISTS `1234`.`Grupa` (
> `kljuc` BIGINT(20) NOT NULL AUTO_INCREMENT ,
> `broj` INT(11) NOT NULL ,
> `vrstaPredavanja` VARCHAR(255) NOT NULL ,
> `predmetKljuc` BIGINT(20) NOT NULL ,
> PRIMARY KEY (`kljuc`) ,
> INDEX `fk_grupa_predmet1` (`predmetKljuc` ASC) ,
> CONSTRAINT `fk_grupa_predmet1`
> FOREIGN KEY (`predmetKljuc` )
> REFERENCES `1234`.`Predmet` (`kljuc` )
> ON DELETE NO ACTION
> ON UPDATE NO ACTION)
> ENGINE = InnoDB
> DEFAULT CHARACTER SET = utf8;
> SHOW WARNINGS;
> This may be completely off the track to the problem,but I do not see hibernate showing numbers in brackets at field types bigint integer.
> Which i think is the problem.
> I have not been able to find any solution to my problem at stackoverflow.com
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list