TABLE Laptop_seq existiert trotz des Hibernate 'Update' Tabellenerzeugung nichtJava

Java-Forum
Guest
 TABLE Laptop_seq existiert trotz des Hibernate 'Update' Tabellenerzeugung nicht

Post by Guest »

Dies ist eine Laptop Entitätsklasse, die PanacheEntity
erweitert, und wir haben eine Laptopresource -Klasse

Code: Select all

import io.quarkus.hibernate.orm.panache.PanacheEntity;
import jakarta.persistence.Entity;

@Entity
public class Laptop extends PanacheEntity {
private String name;
private String brand;
private int ram;
private int externalStorage;
}

import eagle.tailung.entity.Laptop;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import java.net.URI;
import java.util.List;
@Path("/laptop/")
public class LaptopResource {
@POST
@Transactional
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addLaptop(Laptop laptop){
Laptop.persist(laptop);
if(laptop.isPersistent()){
return Response.created(URI.create("/laptop/"+laptop.id)).build();
}
return Response.status(Response.Status.BAD_REQUEST).build();
}

}
< /code>
und ich haben die dieser Anwendung.Properties < /p>
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=username
quarkus.datasource.password=password

quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/hibernate_orm_test
quarkus.datasource.jdbc.max-size=16
quarkus-hibernate-orm.database.generation=update
< /code>
Ich stehe vor einer Ausnahme, wenn ich eine Postanforderung an /laptop sende: < /p>
 
"details": "Error id bedefe4e-3ca0-4731-b2fa-d183959db81d-5, org.jboss.resteasy.spi.UnhandledException: org.hibernate.HibernateException: Could not apply work",
"stack": "org.jboss.resteasy.spi.UnhandledException: org.hibernate.HibernateException: Could not apply work
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:107)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:344)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:205)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:452)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invokePropagateNotFound$6(SynchronousDispatcher.java:275)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:260)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:86)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:151)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:97)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:639)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.hibernate.HibernateException:  C o u l d   n o t   a p p l y   w o r k < b r   / >         a t   o r g . h i b e r n a t e . r e s o u r c e . t r a n s a c t i o n . b a c k e n d . j t a . i n t e r n a l . J t a I s o l a t i o n D e l e g a t e . d o I n N e w T r a n s a c t i o n ( J t a I s o l a t i o n D e l e g a t e . j a v a : 1 7 3 ) < b r   / >         a t   o r g . h i b e r n a t e . r e s o u r c e . t r a n s a c t i o n . b a c k e n d . j t a . i n t e r n a l . J t a I s o l a t i o n D e l e g a t e . l a m b d a $ d e l e g a t e W o r k $ 3 ( J t a I s o l a t i o n D e l e g a t e . j a v a : 9 0 ) < b r   / >         a t   o r g . h i b e r n a t e . r e s o u r c e . t r a n s a c t i o n . b a c k e n d . j t a . i n t e r n a l . J t a I s o l a t i o n D e l e g a t e . d o I n S u s p e n d e d T r a n s a c t i o n ( J t a I s o l a t i o n D e l e g a t e . j a v a : 1 2 5 ) < b r   / >         a t   o r g . h i b e r n a t e . r e s o u r c e . t r a n s a c t i o n . b a c k e n d . j t a . i n t e r n a l . J t a I s o l a t i o n D e l e g a t e . d e l e g a t e W o r k ( J t a I s o l a t i o n D e l e g a t e . j a v a : 8 8 ) < b r   / >         a t   o r g . h i b e r n a t e . i d . e n h a n c e d . T a b l e S t r u c t u r e $ 1 . g e t N e x t V a l u e ( T a b l e S t r u c t u r e . j a v a : 1 3 5 ) < b r   / >         a t   o r g . h i b e r n a t e . i d . e n h a n c e d . P o o l e d L o O p t i m i z e r . g e n e r a t e ( P o o l e d L o O p t i m i z e r . j a v a : 6 5 ) < b r   / >         a t   o r g . h i b e r n a t e . i d . e n h a n c e d . S e q u e n c e S t y l e G e n e r a t o r . g e n e r a t e ( S e q u e n c e S t y l eGenerator.java:585)
at org.hibernate.id.IdentifierGenerator.generate(IdentifierGenerator.java:135)
at org.hibernate.event.internal.AbstractSaveEventListener.generateId(AbstractSaveEventListener.java:155)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:177)
at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:95)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:79)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:55)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:761)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:745)
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.persist(TransactionScopedSession.java:146)
at org.hibernate.engine.spi.SessionLazyDelegator.persist(SessionLazyDelegator.java:282)
at org.hibernate.Session_OpdLahisOZ9nWRPXMsEFQmQU03A_Synthetic_ClientProxy.persist(Unknown Source)
at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.persist(AbstractJpaOperations.java:105)
at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.persist(AbstractJpaOperations.java:100)
at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.persist(AbstractJpaOperations.java:116)
at io.quarkus.hibernate.orm.panache.PanacheEntityBase.persist(PanacheEntityBase.java:768)
at eagle.tailung.entity.Laptop.persist(Laptop.java)
at eagle.tailung.Resource.LaptopResource.addLaptop(LaptopResource.java:24)
at eagle.tailung.Resource.LaptopResource_Subclass.addLaptop$$superforward(Unknown Source)
at eagle.tailung.Resource.LaptopResource_Subclass$$function$$3.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:136)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:107)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
at eagle.tailung.Resource.LaptopResource_Subclass.addLaptop(Unknown Source)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
...  17 more
Caused by: org.hibernate.HibernateException: Unable to perform isolated work
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:193)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.lambda$delegateWork$2(JtaIsolationDelegate.java:90)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doInNewTransaction(JtaIsolationDelegate.java:161)
... 69 more
Caused by: java.sql.SQLSyntaxErrorException: Table 'hibernate_orm_test.laptop_seq' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:912)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:968)
at io.agroal.pool.wrapper.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:80)
at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:250)
at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:149)
at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:136)
at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:58)
at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:187)
... 71 more"

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post