Jdl Studio, can we specified what type of sequence use for id - jhipster

In JDL Studio can we specified what type of sequence we want for an entity, by default jhipster generate an entity with the sequence generator of spring, an unique sequence, can we specified to generate an id autoincrement for have a sequence by entity (postgres) ?

Related

Association without ReferenceVersionField

Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
About the error
I am currently getting the following error when trying to search for manufacturers using $criteria->addAssociation('myCustomEntity'):
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_manufacturer.myCustomEntity.product_manufacturer_version_id' in 'field list'
About the big picture
The use case is similar to the SeoUrl entity where there is a ‘foreign_key’ field which can have a relation to multiple entity types. My entity has not associations, but the other entities are extended to have an association to my entity. Just like the SeoUrl.
However, the DAL creates a query which uses the ‘product_manufacturer_version_id’ field, which does not exist on my custom entity…
Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
No, you must set a ReferenceVersionField when adding associations to the definition of a versionized entity. This is too deeply rooted in the basic principles of the data abstraction layer to work around.
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
You can change the storage name of the field. That is the name of the corresponding column within your database table. When you instantiate ReferenceVersionField you can use the second, optional argument to provide the storage name:
public function __construct(string $definition, ?string $storageName = null)
The storage name should be provided in snake case. The name of the object property for the field will then be derived from the storage name and converted to camel case. So given you provide my_version_custom_id for the storage name, the object property of the entity will be myVersionCustomId.
Your entity may have multiple associations to different entities, but if those entities are versionized your foreign key constraint has to be a combination of columns for both the foreign primary key as well as the foreign version id.

Can any one explain what does it mean by class User extends Model<UserAttribute UserCreationAttribute> means?

See Problem Image
If UserCreationAttribute is created by Omiting one field in UserAttribute Why we using
both in that Arrow and what does it mean I'm confused.
The first generic parameter UserAttribute is used to control what fields can be in the model and the second one UserCreationAttribute is used to validate a set of fields while creating an instance of this model. Usually a primary key field is omitted from creation attributes because it's auto generated. You should add all optional fields there along with the PK field that are not needed if you create a model instance.
It's your responsibility to define creation attributes as a subset of all attributes that's why it's recommended to use Optional with attributes.

What feature need to be enabled for entities filtering on Jhipster?

What those words "When this feature is enabled" on this documentation http://www.jhipster.tech/entities-filtering/ refer to ?
My jdl file is OK (thanks for the recent implemenattion : https://github.com/jhipster/generator-jhipster/issues/6286 )
Command jhipster import-jdl my_jdl_file.jdl work well.
But, I don't know what refer to "this feature" so it doesn't work (with swagger or postman).
Thanks
If you want to enable filtering in JDL you have to:
Use the filter keyword
Your entities must use a service class or implementation.
The sample JDL below will create the filter classes for entity A:
entity A
entity B
filter * except B
service * with serviceClass
If you generate your entities through the prompts, make sure to enable Service Class and Filtering options.
As an example with a Foo entity, in your foo.component.ts, you can add keys to the query object to filter on those fields:
this.fooService.query({ 'id.equals': 953 })
JDL Docs
Entity Filtering Docs

How to specify the type of Primary Key as String in jhipster?

By default, jhipster create entity with id as long/int. I would like to use "String" for id. How to do that?
There are two steps:
Of course the property type in the Java class must be changed to String (and also update the getter and setter for that property).
Then create a Liquibase changeset that modifies the data type to String. See: http://www.liquibase.org/documentation/changes/modify_data_type.html
If there are foreign keys that depend on this id, then makes it a bit more complicated because the fk's will need to be dropped and recreated after the columns have been changed to String.
Take a look at src/main/resources/config/liquibase/changelog to see how to set up a changeset consistent with the jhipster. I usually copy an existing changeset, give it a new file name so that it is the last file in the directory (so you can see a chronological sequence of changes), and update the changeset id.
Then, the changeset must also be added to src/main/resources/config/liquibase/master.xml so that it is activated on the next app start.

ADO.Net Entity Data Model does not decorate fields with required attribute

I am trying to reverse engineer a SQL Server database to an Entity Framework Data Model (version 6.0). The classes are generated fine, but required fields are not decorated as such. As a result the validation is not working (in an MVC 5 web application).
Is there a way to make the model generate these attributes automatically or do I have to manually write meta data classes for all my entities?
Speaking to your question, What are your assumptions for required fields? Do you mean non-nullable?
EF should make any field that is marked as not null as either a non-nullable value type (int, decimal, bool, etc.) or it will make fields required via xml validation. EF doesn't typically add attributes.
MVC will automatically make any value types required, no attribute is required. For strings or other possible nullable types, then you will either need "buddy classes" to add the attributes you need, or you use view models.

Resources