I am using Jhipster and added few entity to my application. Now I want to add row lock feature in few of the transaction to my db. In Hibernate its being done by using session factory as given http://javacompleteexamples.blogspot.in/2009/07/how-db-locking-system-works-in.html but I am not getting beginTransaction and session.get methord using Jhipster code
Not really a JHipster question but rather a Spring Data question.
You could use the #Lock annotation on some method of your repository.
Related
I am new in jhipster and I would like to know If I can create an entity for a view like the table with jhipster command ? And how to do it ?
I used jhipster entity command but I am not sure this is the right way to do it
JHipster does not support SQL views in Liquibase but JDL lets you flag an entity as read-only which will prevent generating code for creating or updating an entity.
You can then manually adapt generated code to replace table by view, it should be limited to Liquibase migration file.
See official JDL doc for examples: https://www.jhipster.tech/jdl/options
jhipster entity command also asks you whether new entity should be read-only.
I'm very new to coding world so I hope I will be clear in my request.
I would like to know if in an Jhipster generated app, I can change the prodDatabaseType from PostgreSQL to MySQL directly in the file .yo-rc.json without the need to generate de novo an other JHipster app?
I have another naive question. Does Spring JPA handle the request for MySQL and PostgreSQL the same way?
Re-generating with MySQL (after modifying .yo-rc.json) will change few properties in application*.yml, pom.xml or build.gradle, docker files, Liquibase xml changelogs and ID generation type in JPA entities.
Knowing this, you should be able to easily merge these changes using git.
does any tool exist that can simplify generation of the new APP if the DB already exists? I can create JDL file for new app manually base on existing DB - but I prefer to automate the process. This DB is part of old Spring Roo app.
Thank you.
The spring Roo 1.x version provides the "Database Reverse Engineering" functionality. This add-on allows you to create an application tier of JPA 2.0 entities based on the tables in your database. DBRE will also incrementally maintain your application tier if you add or remove tables and columns.
After generate the entities, you could execute the necessary web mvc commands to generate the complete application.
However, remember that the Spring Roo 1.x is not beeing maintained, because uses old technologies.
See more about the DBRE process here:
http://docs.spring.io/spring-roo/reference/html/base-dbre.html
Hope it helps,
There's a JHipster module that is being developed for this purpose: https://github.com/bastienmichaux/generator-jhipster-db-helper
It is probably not ready yet but could be a good start.
I have made three different applications in j JHipster with monolithic. I need to merge these applications. I know that by using micro-services my quest can be easy but the current requirement is to do the merging with the monolithic pattern only.
I need to merge two applications with another or main application. I am using MySQL as database. I don't know where I need to change and how. Please help me out, I am a newbie in this scenario.
i tried to create a java file for setter getter methods and and a dao file for three databases and now in the main class file and am trying to take every dao file as an array of object and integrate it and put it into the third db.is it possible.i wanted to show the code bt,since i am new not able to maintain the coding standards to show.
by this i way i tried to involve three databases in a single scenario and want to complete my query through CRUD model.
as you already pointed out, the proper way of merging here would be using the microservice option, which you cannot take, as you are forced to use monolithic architecture...
almost automatic merge
if you did not changed anything to your code, after generating the entities, you just can put the contents of your applications .jhipster directory into one, and run yo jhipster --with-entities to regenerate the entities in one application. You should keep in mind, you will have to take a look at your main/resource/config/liquibase folder, to set the migration ids properly.
manual merge
For this you should be more experienced in the underlying technologies, as you will have to:
recreate your entity classes
recreate zour DAO/Repositories
(maybe) recreate your services, or service implementations
recreate your REST controllers
do a proper liquibase migration
provide some tests
migrate the frontend code, by adding states, components, templates etc..
the most of these things you just can copy paste already generated code.
For more information, you should ask more precise, what is not working, if you already tried something...
For doing authorization in asp.net mvc 5 I have searched lot on internet but not getting correct answer. Actually I am using Visual studio community edition with .net framework 4.5.2 and mvc5. I want to do the Authorization in my project. My project is created with no authentication mode while creating a project.
Firstly I have tried these things:
I typed a command "Enable Migrations" on Package manager console.
Then I got one error like: Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.
I dont know how to resolve this error. please help me to get out of it.
Which approach did you chooses to build our database model? Code First, Model First or Database First?
I'm asking because you can't use migrations with Model First or Database First approach. EF Migrations is a product targeted for Code First approach. CodeFirst assumes that you will never make any changes manually to the database. All the changes to the database will go through the code first migrations.
But there is solution for that - you can use Code First approach with an existing database. Take a look here: Using EF “Code First” with an Existing Database.