-1

I am creating a repository:

@Repository
public interface UserRepository extends JpaRepository<UserRest, String>{

}

and I create a UserResourceTest rest controller:

@RestController
public class UserRestResource {

    @Autowired
    private UserRepository userRepository;

    @GetMapping("/userrest")
    public List<UserRest> userAll() {
        return userRepository.findAll();
    }
}

This generates two classes {user_rest, hibernate_sequence}. instead of consuming userrest.

Can someone help me what am I doing wrong?

Giorgi Tsiklauri
  • 9,715
  • 8
  • 45
  • 66
KelvinLB
  • 3
  • 1
  • 2

2 Answers2

0

Add in model class UserRest annotation @Table parameter name = userrest

@Entity
@Table(name = "userrest")
public class UserRest 
0

Check out Hibernate: Automatically creating/updating the db tables based on entity classes and How to turn off hbm2ddl?

And change your persistence.xml or config class accordingly! (hibernate.hbm2ddl.auto should be none)

Onur Baştürk
  • 715
  • 5
  • 15