1) Don't look at online samples as production code. That online sample is meant to show you how to use Spring Data. It's not something you can just copy paste into your code and have it work without any other work. You can load many of those hardcoded elements through an external properties file Look at
this page for how you can load properties in an XML less configuration
2) Hibernate, Spring JPA and Spring data provide differrent functionality. All of them uses annotations, but that doesn;t mean all of them do the same thing. Each of them brings it's own value.
Hibernate provides an ORM layer. It basically provides a library that among other things, primarily allows you to map database entities to
Java classes. Hibernate doesn;t provide declarative transaction and session management. Usually, if you are going straight to Hibernate, you will be implementing a DAO class in which you will make the appropriate class to create a Hibernate session, start/stop transactions and call hibernate to do CRUD operations on your data. Hibernate doesn't eliminate the need to write a DAO layer. Your DAO layer becomes smaller (and database independent) compared to straight
JDBC.
JPA and Spring's support for JPA provides declarative transaction management, and autowiring of the JPA entity manager. You are gain not eliminating the DAO layer completely. You are reducing the amount of boiler plate code in the DAO layer as compared to a DAO implemented with Hibernate. You will declare your EntityManager in your configuration and Spring IoC will do the job of "giving" the EntityManager to your DAO. ALso, you can put Transactional annotations on your DAO/service methods, and Spring will do the work of "weaving" session/transaction management code into your code. This allows your DAO to focus on your entities instead of being filled with boiler plate code. All your DAO has is the calls to EM to do CRUD operations with your entities.
Spring Data, OTH, almost eliminates the need to implement a DAO layer. ALl you do is write your entity classes, write JQL and declare some interfaces. For most part, you don't need to write a line of DAO code. As an application developer, you can focus on doing the database design and focus on the service layer that contains the business logic