Nao sei pq, ele aparece que executo o codigo que gera as tabelas automatico, mais quando dou um insert, fala que nao possui a tabela. Observo no msyql e realmente nao criou a tabela… pq será ? Utilizo o macOs… o banco ta instalado e rodando…
Hibernate:
create table clube (
id bigint not null auto_increment,
nome varchar(255),
porcentagemRake double precision,
primary key (id)
) type=InnoDB
Hibernate:
create table GanhosSemanal (
id bigint not null auto_increment,
data datetime,
ganhosClubeBuyInTicket double precision,
ganhosClubeTaxa double precision,
ganhosJogadorSeguro double precision,
possuiPpst bit not null,
clube_id bigint,
primary key (id)
) type=InnoDB
Hibernate:
create table GanhosSemanal_PPST (
GanhosSemanal_id bigint not null,
listaPpst_id bigint not null
) type=InnoDB
Hibernate:
create table PPST (
id bigint not null auto_increment,
data datetime,
ganhosJogadorGeral double precision,
clube_id bigint,
ganhoSemanal_id bigint,
primary key (id)
) type=InnoDB
Hibernate:
alter table GanhosSemanal_PPST
drop index UK_8i81ngtmd4vssefivgnh3l9rs
Hibernate:
alter table GanhosSemanal_PPST
add constraint UK_8i81ngtmd4vssefivgnh3l9rs unique (listaPpst_id)
Hibernate:
alter table GanhosSemanal
add constraint FKc5b5digqgf6246p2p3ijotm11
foreign key (clube_id)
references clube (id)
Hibernate:
alter table GanhosSemanal_PPST
add constraint FKk2wyi0vmxfon0qmxogkwv7v9k
foreign key (listaPpst_id)
references PPST (id)
Hibernate:
alter table GanhosSemanal_PPST
add constraint FKo084d7tne6eb434si96m631hr
foreign key (GanhosSemanal_id)
references GanhosSemanal (id)
Hibernate:
alter table PPST
add constraint FKq7ltj05x2pxrgjv0tg4s45heh
foreign key (clube_id)
references clube (id)
Hibernate:
alter table PPST
add constraint FK3c6jtqec4p5il4pg3u9w22s68
foreign key (ganhoSemanal_id)
references GanhosSemanal (id)
Hibernate:
insert
into
clube
(nome, porcentagemRake)
values
(?, ?)
Exception in thread “main” javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:802)
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:778)
at br.com.mavenpoker.Util.GeraBancoUtil.main(GeraBancoUtil.java:34)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute statement
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
at org.hibernate.dialect.identity.GetGeneratedKeysDelegate.executeAndExtract(GetGeneratedKeysDelegate.java:57)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3152)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3756)
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:84)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:645)
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:282)
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:263)
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:317)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:330)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:123)
at org.hibernate.event.internal.DefaultMergeEventListener.saveTransientEntity(DefaultMergeEventListener.java:271)
at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:243)
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:175)
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:70)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102)
at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:791)
… 2 more
Caused by: java.sql.SQLSyntaxErrorException: Table ‘pkr.clube’ doesn’t exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
… 21 more
Bloco de Citação
Bloco de Citação<? xml** version= *"1.0"* encoding= *"UTF-8"* ?>
< 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"*
version= “2.0” xmlns= “http://java.sun.com/xml/ns/persistence” >
< persistence-unit name= “pkr” transaction-type= “RESOURCE_LOCAL” >
< properties >
< property name= “hibernate.dialect” value= “org.hibernate.dialect.MySQLInnoDBDialect” />
< property name= “javax.persistence.jdbc.driver”* value= “com.mysql.cj.jdbc.Driver” />
< property name= “javax.persistence.jdbc.url”* value= “jdbc:mysql://localhost:3306/pkr” />
< property name= “javax.persistence.jdbc.user”* value= “root” />
< property name= “javax.persistence.jdbc.password”* value= “12345” />
< property name= “hibernate.hbm2ddl.auto” value= “update” />
< property name= “hibernate.show_sql” value= “true” />
< property name= “hibernate.format_sql” value= “true” />
< property name= *“hibernate.hibernate.cache.use_query_cache” value= “true” />
</ properties >
</ persistence-unit >
</ persistence >
@Entity
@Table (name = “clube”)
public class Clube {
@Id
@GeneratedValue (strategy = GenerationType. IDENTITY )
private Long id;
@Column
private String nome;
@Column
private Double porcentagemRake;