Because of some reason, I want to use my current java entity classes to generate all entity related files, which are generated with yo jhipster:entity book. I need the liqibase configuration files, repository files, rest resources, and the sample files of html and js files.
So is there any way I can do that?
I don't think there's a way to do that at the moment. But with JHipster 2 you could manually create a .jhipster/{entityname}.json file based on your class, and that would generate those files (and also recreate the class object) you're looking for.
Related
I am using schemacrawler cli to generate diagrams for my database.
I do not have many FK relationships in my db and so I am relying on weak-associations. But the these weak associations are not accurate. Is there any way to plugin custom logic for this detection?
The only associations that I want to plot are:
When tablename_id column in any table in a database maps to tablename.id in the same database. There are thousands of these associations.
Plus the 10 or 20 custom defined associations in the yml file.
I know I can manually define the associations in the yaml file but that is not a feasible option. I also know that I can build a custom script to generate the said yaml file, but that might not be as performant as being able to plugin the logic into the flow.
You should be able to plug in a custom catalog loader. Catalog loaders are loaded by the Java Service Provider Interface (SPI), and the WeakAssociationsCatalogLoader itself is loaded dynamically from the CLASSPATH. You can write your own implementation in your own jar file, and add it to the CLASSPATH, or simply drop your jar into SchemaCrawler's lib folder if you are using the command-line. Your jar file should have the SPI properties file, like this one - schemacrawler.tools.catalogloader.CatalogLoader.
It seems like your idea may be useful to other people. If you make your implementation an open-source project, please let me know, and I will link to it from the SchemaCrawler website.
Sualeh Fatehi
SchemaCrawler
So, I can see many files under customize folder under platform.
Is there any other way to oveerride platform in general other than putting it in customize folder?
If we have to override some OOTB file there are two ways:
1) If its in some extension, we can create customized extension and do our changes.
2) Add stuff into customize folder and do ant customize.
What if OOTB file is in platform? Is there any other way?
I expect to customize platform without adding it to customize folder.
Is the function/bean you want to override is injected through Spring?
If no, and you need to override say some jar, class or xml. You have choice of ant customize or buildcallbacks.xml
If yes, it's no different than overriding any other beans from parent extension. The only thing is that you will not need to create an extension dependency as platform is available globally.
For example : If you wish to override some function in DefaultCatalogDao to give your own implementation. You can do it like...
Create your own implementation extending the platform related service
Inject your custom bean with alias of the defaultCatalogDao
<alias alias="catalogDao" name="customCatalogDao"/>
<bean id="customCatalogDao" class="......CustomCatalogDao" parent="defaultCatalogDao"/>
For Commerce Cloud
You can change platform files using customize folder in Commerce Cloud V2 too. You would need to create a folder in your custom repository with name _CUSTOMIZE_ and then as you do in non cloud version, add your files (with exact folder structure as in platform).
Once you creare above folder, CCV2 build strategy automatically picks and deploys it, without any additional configuration.
Hope it helps!
Using buildcallbacks you can replace the files even the files in platform jar .
You can simply copy paste your file or write your own shell script to execute it and copy file to platform but how would it be different from ant customize. And why would you want to go away from standard hybris practices? Would that give you any extra benefit? I am sure that would only lead to issues during upgrade etc. Its not spring bean injection where you could tell your platform to use your implementation instead on other. There is no sense in wasting time in finding something which doesnt go along with product best practices.
I'm using jHipster 4.14.4 . When using the generator to generate entities, it seems it does not generate the default fields like last_modified_by and last_modified_by, neither in the XML files for the DB or the class files. Am I wrong to assume these are included by default? I need these to be able to sync with an offline app I'm building.
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...
i'm newbie in JHipster and i'm trying to figure this, when i create a new entity JHipster generates several files, angular, html and java classes, now if i want a common code for all this generated code i must edit each time that i use the yeoman generator? what i want is:
Custom Index template, and pages, is secure to edit them?.
Customize the entity tables, entity forms using angular, maybe extending yeoman generators
Customize generate java classes, maybe i think using AOP
So i need to edit each time for each generated code? and is a good practice this or what i want? for clarify more i want to use a Custom Bootstrap/angular Dashboard template like Minovate, i see how to customize bootstrap in the documentation but not about what i'm asking for, Thanks.
JHipster is just a code generator, once generated the code is yours.
For angular screens I would say do as much as you can in CSS/SASS.
But it's very likely that you will need to build some screen mixing several entities and change the structure of entity screens.
So you should rather consider them as a starting point and do your own stuff in another folder so that it does not get overwritten by next re-generations.
This way you can still update your entity definitions in .jhipster folder and re-run yo jhispter:entity <entity name> on the entities you modified.
Customising java Entities is usually much simpler and you can easiliy achieve this by merging generated code with git and defining your service classes.
AOP seems overkill here.
Extending a yeoman generator is a lot of work.
I suggest to use some VSC (git, subversion or whatever you like) have a branch dedicated to plain jhipster generated code and another one where you make customization.
Eventually regenerate on jhipster branch and merge back on yours.
You should at least reduce manual intervention.