0

model:

    package com.example.webs.model;
    
    import java.util.Date;
    
    import jakarta.persistence.GeneratedValue;
    import jakarta.persistence.GenerationType;
    import jakarta.persistence.*;
    
    @Entity
    @Table(name = "empleado")
    public class Empleado {
        
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(unique = true, nullable = false)
        private Long idemple;
        private String nombre;
        private String apellido;
        private Date fecha_naci;
        private String genero;
        
        
        public Empleado() {
            
        }
        public Empleado(Long idemple, String nombre, String apellido, Date fecha_naci, String genero) {
            super();
            this.idemple = idemple;
            this.nombre = nombre;
            this.apellido = apellido;
            this.fecha_naci = fecha_naci;
            this.genero = genero;
            
        }
        
        public Long getIdemple() {
            return idemple;
        }
        public void setIdemple(Long idemple) {
            this.idemple = idemple;
        }
        public String getNombre() {
            return nombre;
        }
        public void setNombre(String nombre) {
            this.nombre = nombre;
        }
        public String getApellido() {
            return apellido;
        }
        public void setApellido(String apellido) {
            this.apellido = apellido;
        }
        
        public Date getFecha_naci() {
            return fecha_naci;
        }
        public void setFecha_naci(Date fecha_naci) {
            this.fecha_naci = fecha_naci;
        }
        public String getGenero() {
            return genero;
        }
        public void setGenero(String genero) {
            this.genero = genero;
        }
        @Override
        public String toString() {
            return "Empleado [idemple=" + idemple + ", nombre=" + nombre + ", apellido=" + apellido + ", fecha_naci="
                    + fecha_naci + ", genero=" + genero + "]";
        }
        
        

}

lo que me arroja al ejecutar:

 Hibernate: 
    create table empleado (
        idemple number(19,0) generated as identity,
        apellido varchar2(255 char),
        fecha_naci timestamp(6),
        genero varchar2(255 char),
        nombre varchar2(255 char),
        primary key (idemple)
    )
    
    
  lo que me arroja la ejecucion:

    [2m2024-03-08T17:54:02.301-05:00[0;39m [33m WARN[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mo.h.t.s.i.ExceptionHandlerLoggedImpl    [0;39m [2m:[0;39m GenerationTarget encountered exception accepting command : Error executing DDL "
    create table empleado (
        idemple number(19,0) generated as identity,
        apellido varchar2(255 char),
        fecha_naci timestamp(6),
        genero varchar2(255 char),
        nombre varchar2(255 char),
        primary key (idemple)
    )" via JDBC [ORA-02000: falta la palabra clave ALWAYS

https://docs.oracle.com/error-help/db/ora-02000/]

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "
    create table empleado (
        idemple number(19,0) generated as identity,
        apellido varchar2(255 char),
        fecha_naci timestamp(6),
        genero varchar2(255 char),
        nombre varchar2(255 char),
        primary key (idemple)
    )" via JDBC [ORA-02000: falta la palabra clave ALWAYS

https://docs.oracle.com/error-help/db/ora-02000/]

[2m2024-03-08T17:54:02.301-05:00[0;39m [33m WARN[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mo.h.t.s.i.ExceptionHandlerLoggedImpl    [0;39m [2m:[0;39m GenerationTarget encountered exception accepting command : Error executing DDL "
    create table empleado (
        idemple number(19,0) generated as identity,
        apellido varchar2(255 char),
        fecha_naci timestamp(6),
        genero varchar2(255 char),
        nombre varchar2(255 char),
        primary key (idemple)
    )" via JDBC [ORA-02000: falta la palabra clave ALWAYS

https://docs.oracle.com/error-help/db/ora-02000/]

EL ERROR QUE SALE:

at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:94) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:574) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:514) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:315) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:80) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:232) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:117) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:286) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:145) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at java.base/java.util.HashMap.forEach(HashMap.java:1429) ~[na:na] at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:142) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at

org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315) ~

[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
        at 

org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final] at

org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.4.jar:6.1.4]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:388) ~[spring-orm-6.1.4.jar:6.1.4]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.4.jar:6.1.4]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.4.jar:6.1.4]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:364) ~[spring-orm-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.4.jar:6.1.4]
    
    
    
        at 
    org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.4.jar:6.1.4]


        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.4.jar:6.1.4]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1231) ~[spring-context-6.1.4.jar:6.1.4]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:949) ~[spring-context-6.1.4.jar:6.1.4]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.4.jar:6.1.4]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.3.jar:3.2.3]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.3.jar:3.2.3]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.3.jar:3.2.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.3.jar:3.2.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.3.jar:3.2.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.3.jar:3.2.3]
        at com.example.webs.WebsApplication.main(WebsApplication.java:11) ~[classes/:na]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.3.jar:3.2.3]
    Caused by: java.sql.SQLSyntaxErrorException: ORA-02000: falta la palabra clave ALWAYS
    
    https://docs.oracle.com/error-help/db/ora-02000/
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:702) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:608) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1330) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:1102) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:456) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:498) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:190) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1368) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.OracleStatement.executeSQLStatement(OracleStatement.java:1958) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1594) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:2636) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:2585) ~[ojdbc11.jar:23.3.0.23.09]
        at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:334) ~[ojdbc11.jar:23.3.0.23.09]
        at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) ~[HikariCP-5.0.1.jar:na]
        at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-5.0.1.jar:na]
        at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:80) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
        ... 41 common frames omitted
    Caused by: oracle.jdbc.OracleDatabaseException: ORA-02000: falta la palabra clave ALWAYS
    
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:710) ~[ojdbc11.jar:23.3.0.23.09]
        ... 56 common frames omitted
    
    [2m2024-03-08T17:54:02.313-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Initialized JPA EntityManagerFactory for persistence unit 'default'
    [2m2024-03-08T17:54:02.360-05:00[0;39m [33m WARN[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mJpaBaseConfiguration$JpaWebConfiguration[0;39m [2m:[0;39m spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
    [2m2024-03-08T17:54:02.519-05:00[0;39m [33m WARN[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mion$DefaultTemplateResolverConfiguration[0;39m [2m:[0;39m Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
    [2m2024-03-08T17:54:02.609-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mo.s.b.d.a.OptionalLiveReloadServer      [0;39m [2m:[0;39m LiveReload server is running on port 35729
    [2m2024-03-08T17:54:02.635-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat started on port 8080 (http) with context path ''
    [2m2024-03-08T17:54:02.648-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36mcom.example.webs.WebsApplication        [0;39m [2m:[0;39m Started WebsApplication in 2.196 seconds (process running for 2214.55)
    [2m2024-03-08T17:54:02.653-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[  restartedMain][0;39m [2m[0;39m[36m.ConditionEvaluationDeltaLoggingListener[0;39m [2m:[0;39m Condition evaluation unchanged
    [2m2024-03-08T17:56:16.882-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [2m[0;39m[36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring DispatcherServlet 'dispatcherServlet'
    [2m2024-03-08T17:56:16.883-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [2m[0;39m[36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Initializing Servlet 'dispatcherServlet'
    [2m2024-03-08T17:56:16.885-05:00[0;39m [32m INFO[0;39m [35m9916[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [2m[0;39m[36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Completed initialization in 2 ms
1

1 respuesta 1

0

Veo que en ejecución te bota este error"ORA-02000: falta la palabra clave ALWAYS", probablemente se lanza esto porque estas tratando de conectarte a un oracle 12c y el cliente que tienes instalado localmente no soporta esa característica, por lo cual te recomiendo revises la versión de tu cliente oracle, este debería ser 11g o menor

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.