Can I use Spring JPA with a read only database? - java

I'm doing a programming exercise tomorrow where I will have to pull data from a database and display it as a table on a web page using the Spring framework. My Initial thought was to use the Spring JPA for accessing the MySQL database, but I have since learned that the database will be read only.
Would this mean the Spring JPA would give errors when trying to connect? Is the best option in this situation to use regular JDBC functionality?
Many thanks

Related

Embedded DBs compatible with SQL Server Data

Working on a JAX-RS application which uses Microsoft-SQL-Server as a Database.
It does not use any ORM frameworks, just plain old JDBC.
Most of the application's operations involve store and retrieve data as XML into DB tables.
I have a use case where I have to run this application offline. So there wont be any connection available to DB SQL-Server.
Whilst looking into my options thought I would embed the DB and ship with the application EAR.
Looking into options I learned that, SQL-Server-Compact does not have a proper JDBC driver.
Is there any other In-Memory DB that could serve my purpose?
I want avoid any code changes like: changing the SQL queries (written specifically for Microsoft-SQL-Server).
Is there any solution which I can use and ship my application just by changing the DataSource to embedded DB?
note: I could not find any useful post on stackoverflow for this query, If it's already been discussed. Please point me to the post and I will delete this duplicate question.

Spring Application JPA and JDBC

I am starting with a new project and currently evaluating whether to use JPA or JDBC. Our operations mostly are going to be an bulk-insert and bulk-read and very rarely single insert/read.
I checked a prototype with JPA and JDBC and realized that both has its own merits and limitations.
Considering the current use case that for a fact I will only have always a bulk read and bulk write, which one will be a better option to go with ?
Spring JPA Repository gives a simple method save(Collection) which can take a collection and save as well.
Also Validations are also not be considered here, as the payload will already be validated in the layers above and the database layer should just do the read/write operations.
Does the JPA save(Collection<>) method in turn uses the jdbc templates or is it entirely a different implementation ?
Thanks in advance !
We use both JPA and JDBC in one application wiht no problem. Preferably we use JPA/JPQL and fall back to JDBC if needed. For JPA we use Spring Data JPA and for JDBC Spring JDBC Template.

What ORM should I use for Spring MVC Project with Derby db?

i'm developing a web project which use Spring MVC and an apache derby embedded. This database contains a table for Users, Roles and Users-Roles. I have to do a typical CRUD. Due to it is my first time using derby. I tried to access my db using java.sql.Connection, java.sql.ResultSet, etc. It works good, is it necessary to connect to the db manually and write sql code in java classes?
Somebody recommended me using Spring jdbctemplate. I'm looking for something like Ibatis, which maps the objects and db entities transparently.Is it possible to use Spring JdbcTemplate with iBatis??
Thank you
I'd recommend Hibernate simply because it's supported by Spring and has really nice transaction management with Spring. There's also tonnes of documentation about Spring with Hibernate.
Hibernate also has strong support with Derby and all you need to do is put the correct dialect in.
Spring is compatible with both ORM, Hibernate and iBatis. In order to know which works best for you, there is a good write-up comparing both these frameworks. Here is the link. Secondly to integrate iBatis with Spring, here is a starter example.

One web app accessing different databases with the same structure

I created a java web application using Spring Roo as the persistence layer and MySQL as the database.
I'll have several customers using that application but it has to be one database per customer. I mean, the same database structure for everyone but having one database(schema) per customer. So how to do that using the current technologies in my application?
I was thinking of something like a URL parameter indicating what schema to use, for example:
Customer 1 should use: http://www.myapp.com/?schema=dbcustomer1
Customer 2 should use: http://www.myapp.com/?schema=dbcustomer2
So now I'm wondering how to pass that schema param value to the Spring Roo's database connection at runtime. Currently it's hard coded in the database.properties file generated by Roo?
Please, also let me know if you think there is a better approach to achieve that.
Thank you,
Gyo
You can customize your Spring Roo application just the way you approach multi-tenancy in a traditional Spring based application.

Use Hibernate and Ibatis in the same application

I need to write a new app but using some data acces logic from other two app. One uses Hibernate and the other uses iBATIS. Can I use in the same app both, Hibernate and iBATIS?. How?.
Update: Let me reformule my question. Let's forget I will rehuse some DAOs or domain clases. I need to use in the same app, Hibernate and iBATIS. How can I do that? Thanks for your time...
check appFuse project. it has skeleton implementations for both orms. just combine both of them into the same app. database usually doesn't care what's behind the jdbc driver that accesses it

Categories

Resources