More than one table found in namespace (, ) - SchemaExtractionException

后端 未结 10 3239
执念已碎
执念已碎 2021-02-20 18:52

I have been facing this weird exception while trying to persist some values into a table using Hibernate in a Java application. However this exception occurs only for one parti

相关标签:
10条回答
  • 2021-02-20 19:21

    I also came across this issue. Here is my solution:

    the error: https://gist.github.com/wencheng1994

    I solve that. It mainly because the db account has a higher authority. I set the "hibernate.hbm2ddl.auto=update", So when hbm2ddl works, it tried to find all exists shcema I defied. But there is two schema exist the table with the same name. then the db account can find that. so it found "more than one table in the namespace"

    All I need to do is to make the db account lower authority so that it can not find table in other schema. (one shcema relation one db account).

    0 讨论(0)
  • 2021-02-20 19:22

    So after having the same issue, it turns out that I needed to update my OJDBC driver from ojdbc6 to ojdbc8. Hopefully this helps.

    0 讨论(0)
  • 2021-02-20 19:23

    Another situation may be occurred except whatever dear RichB has been stated. in ORACLE every user has separate schema , Therefore probably there is tow tables with the same name in two different schemes then you should specify your default schema in persistence.xml with below property

    <property name="hibernate.default_schema" value="username"/>
    
    0 讨论(0)
  • 2021-02-20 19:26

    I have same issue with such configuration

    @Entity
    @Table(name = "NOTIFICATION")
    public class Notification {
        ...
    }
    

    issue was resolved for me when I moved table name from @Table to @Entity

    @Entity(name = "NOTIFICATION")
    @Table
    public class Notification {
        ...
    }
    
    0 讨论(0)
提交回复
热议问题