Java – add schema names to entities in spring data?

Error using Oracle dB and spring data The error is:

ORA-00942: table or view does not exist

The reason for this error is that the user I connect to cannot access the table in the schema I want to connect to

I read that these two fixes are to create synonyms in my database or specify the schema to which each entity / table belongs

I'll try the schema method first What should I do?

My following example entity, dog in veterinary mode:

@Entity
@Table(name = "Dog")
public class Dog
{
    @Id
    private String id;

    @Column(name = "NAME")
    private String name;

    @Column(name = "Owner")
    private String owner;

  //getters and setters etc...

Solution

@The table annotation provides the schema attribute:

@Table(name = "Dog",schema = "Vet")
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>