I have an existing application which I want to extend by an embedded database. I have some experience with 'raw' derby (writing the sql statements by myself). For this application I use eclipse with maven but no additional framework for the application itself.
I have no experience with the spring framework but I came accross JPA data repositories (spring-data-jpa from org.springframework.data) which seems for me the way to go. But is it possible to use for the moment for this application only the data repositories of spring? Or will this lead to changes in the existing Code as one can not use only the data repositories alone?
Related
I am working on a web application which will serve as an SQL injection learning platform with multiple levels in spring boot and react. I am using PostreSQL as my main database, but I also wanted a lightweight solution for a vulnerable database on which the injections will occure. I was going to choose H2, but it isn't supported on Heroku where I wanted to deploy my application, as I worked with it in the past and it's already familiar.
So the question is: What other platform could I use to work with H2 or should I choose something else instead of H2, and if yes, what?
The way I handle this is to use spring-bean "profiles"
default
or
!default
I use H2 all the time for local-development mode (using 'default' spring bean profile to achieve this).
Now, we do not over-use spring-profiles. We have default and !default. And that is is.
All my JPA stuff works with H2.
Is it possible to use JPA within plain Java applications resulting in JAR files run locally? I often used the EntityManager and #Entity annotations for web application creation resulting in WAR files and configured the persistence unit for use over databases configured and managed within the Wildfly server. I find this functionality quite convenient and would like to use it outside of an application server environment. Are there working examples to that? Or maybe similar approaches?
Try SpringBoot using JPA, here is a definitive guide by Spring: https://spring.io/guides/gs/accessing-data-jpa/
Using springboot, you can get a single jar file with it's dependencies within it.
What is the difference between these Spring Boot jars.
spring-boot-starter-data-mongodb jar
spring-data-mongodb jar
mongodb-driver jar
mongodb-driver-core jar
What I understand in those all is that mongodb-driver is the java driver for mongoDB. And spring-boot-starter-data-mongodb is starter like spring boot has for many (spring-boot-starter-web, spring-boot-starter-test).
Can someone please explain their role in Spring boot.
mongodb-driver-core: The Java operations layer for the MongoDB Java Driver. Third parties can ' + 'wrap this layer to provide custom higher-level APIs.
mongodb-driver: The driver which allows you to connect to MongoDB databases from java applications.
spring-data-mongodb: The library you need to use Spring Data with MongoDB in your project, which might not be Spring Boot based.
spring-boot-starter-data-mongodb: The starter for using Spring Data Mongo DB in Spring Boot, with everything you need for that.
Note that each of these libraries makes use of the other ones above, so it increases abstraction.
See also:
https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-core
https://projects.spring.io/spring-data-mongodb/
https://spring.io/guides/gs/accessing-data-mongodb/
I created a simple Java application and use Hibernate to deal with postgres database. I want to use Spring Data JPA with Hibernate in my project. Is there a way to do that?
I've created a "framework/toolkit" for a specific type of database search. This was done with Spring-Data JPA using hibernate. This framework is usable by standalone desktop app or as a web application.
This framework ships with entity classes, Spring-Data Repositories and a transactional Service layer with optional method level security (spring-security annotations).
now I would like to create a web application using this framework. Since grails is from spring to and also uses hibernate I thought this might work but I'm open to other suggestions.
The entities in the web application will extend such provided by my framework and should use spring-data repositories extending repositories provided by the framework and services extending provided services for data access.
Or said otherwise I'm mainly interested in the scaffolding part (controller and CRUD web pages) and not the data access part. I'm open to any other tools that can achieve this.
Is this possible with grails? Other suggestions? Spring Roo?