Spring kundera cassandra - spring-boot

Is it possibility to populate database after auto creating with Kundera?
I have prepared import.cql file with required data for application and need something like
<property name="hibernate.hbm2ddl.import_files" value="import.sql"/>
Thanks for advance

No, you have to manually run these scripts to create application data. Only Schema Generation using Kundera is possible.

Related

Spring boot configuration custom sql

I am trying to play with oracle edition views using spring data jpa and everything works fine.
The problem is if we can configure the specific oracle views in spring boot. Is this possible and how?
Thanks for your help in advance.
Vicky
It was very easy which I overlooked.. during the data source creaion we can pass the SQL that we need to trigger... This helped me load views..

jdbc data independence without using hibernate api?

I am trying to solve problem by using properties file but in properties file we can handle only database driver problem.if we want to mysql to oracle database need to change all my query.the problem is now how to make query independent without hibernate api?? please suggest

How to insert data to table on spring boot application start?

How can I insert data to a table on Spring Boot application start? My application is generated by JHipster. What I need to check is that if that particular data already exist in that table or not. If it doesn't I should add it.
If your application was generated by JHipster, then it should already include and be properly configured for Liquibase.
You have a few options:
You can use Liquibase's insert change to insert data.
You can put your data in a CSV file and use the loadData change to load it. Look for the loadData tag in 00000000000000_initial_schema.xml for examples.
You can use the sql change to run native SQL directly.
All three options can be combined with preconditions to make sure the data doesn't exist before trying to insert it. If you need the changeset to run every time you boot your application, you can use the runAlways="true" attribute (docs for that are on this page).
You can create a function in your service class which checks if the data already exists or not and if not then save that data.
You can implement an ApplicationRunner and use a repository to do whatever you need to do.
If the ApplicationRunner is a spring bean it is run on application startup.
For more sophisticated requirements I would try to rely on a tool like flyway that has good integration with spring boot

How to load csv file to GemFire using Spring XD Job

Has anyone one work or guide on how to load csv file to Gemfire database using Spring XD job? Reference or example will help.
Thanks
If you want to run this as a batch job then I believe you can use filejdbc OOTB job module.
Spring XD doesn't have an OOTB job for raw Gemfire. As Ilaya points out, if you're using Gemfire's SQL support (via Sqlfire or Gemfire XD) you can use the filejdbc job. Without that support, you'd need to write a custom job that imports the data using Spring Batch's GemfireItemWriter support.
If you want to load csv files into gemfirexd, you can use the build-in system procedure SYSCS_UTIL.IMPORT_DATA_EX().

Spring Roo #RooJpaActiveRecord parameterized the JPA table catalog

I need a why to change the JPA catalog element in my java class? We have many database environments which we need to be able to deploy our application too. Example: In your dev environment we have a database for new development, and production support. All database live on the same server so we have the following database names: am_web_dd and am_web_ps. So we need to be able to change the catalog at build time or start up time. We've thought of using Maven to do a search and replace during build but I was wondering if there is a way of doing this with a parameter?
Here is one of our #RooJpaActiceRecord statements:
#RooJpaActiveRecord(catalog = "am_web_t4", schema = "dbo", table = "user_t")
I would like to be able to make catalog a parameter. Is this possible? if not what would be the best approach?
Thank you for your time!
I know it is possible from a JPA standpoint, but I don't think you will be able to using straight Roo. This might help.
There may also be a way to use a Java Configuration object in Spring to build your JPA Entity Manager. I think that's were you want to set it.
The approach you suggest of making catalog dynamic would be suitable if you wanted to let the user choose/change the schema on demand, however, it looks like this is not your requirements, so I would steer away from this path as it more difficult than you need.
You can use spring profiles to define different database connections and use an environment variable to define which one is active. Spring profiles can be set in XML or java configuration classes.

Resources