mark smith

Ranch Hand
+ Follow
since Apr 05, 2005
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mark smith

thymeleaf + htmx you can do like a spa
1 year ago

i use spring boot 2.3.2 with spring data and hibernate.

I have a Enum

I have an enitty

In my repository i tried theses solutions without success

If I do like that that working

I see some thread like this one: who have similar issue.

3 years ago

I use jpa with hibernate

I use IdCass for a composite key.

Save code

When Samplings is saved, samples is saved but sampling_id  and sampling_year are empty

any idea?
6 years ago
I use spring boot with spring-data-jpa and hibernate implementation

I have a many to many relations

Actually if I take a person, add some address and save... person and address are saved.

I would like to be able to do also from the other side: address, add person and save

tried to put on both cascade = {CascadeType.MERGE, CascadeType.PERSIST} on both side, but it don't work

i have an application with rest architecture in spring boot.
i have an other application  in spring boot who use spring mvc (thymeleaf)

mvc will call rest service with resttemplate

we would like to add security to spring rest and spring mvc.

what could be solution to add security?

6 years ago

I use spring boot in a rest architecture and i would like to allow only some user to access some function.

In one of my service interface, i added this annotation


but actually that don't work, all role seem to have access to this function

do i need another thing to setup in the config?
7 years ago

I use spring boot, i created a class who extends WebSecurityConfigurerAdapter

I can log without problem to the application.

Now i would like to allow only some role to acess some url

I added

My user has ROLE_USER role and access report page without problem, do i need to add any other configuration to get it working?

7 years ago

i search a library on the client side to do i18n.
don't know if there are some who exist where we need to put a tag and the key...

something like

other info

Jesper de Jong wrote:There are multiple issues going on here.

The first one is: how do you store an enum in the database? There are different ways to do this, each with pros and cons.

1. You can store the enum ordinal (the index of the enum constant in the definition of the enum). Pros: simple and you don't need to add extra code to the enum. Cons: if you re-order the enum constants, or add a new constant in between existing constants, the ordinals will change and things break.

2. You can store the name of the enum constant as a string in the database. Pros: simple, you don't need extra mapping code. Cons: strings take up more space than a simple int value (such as an ordinal) in the database.

3. Have some explicit mapping from enum constants to codes, store those codes in the DB, and then translate back and forth as you save / load values from the DB. Pros: You don't have the problem of changing ordinals as with solution 1. Cons: Needs more code, because you need to do this mapping.

The second issue is displaying on the client side. This is a completely separate issue from how you store enum values in the database. You'll need to have some mapping mechanism (for example a Properties file) to convert enum values to display texts. But as I already said, this is separate from how you store enum values in the database. There is no need to store the display texts in the database whenever you need to store an enum value (which you seem to imply when you say "store key/value pairs in the database?").

thanks for theses information

Actually to store information, i use @Enumerated(EnumType.STRING)
On the client side, i display directly the value of this... that bad

Need to find a library on the client side to be able to do i18n.

Don't know if one exist where i could put a kind of 18n tag in the html file

coderanch is maybe not the place to talk about js...

8 years ago

I have a spring boot, application with rest architecture and JQuery on the client side

Many time in a applicaiton, we have static value: like type of communication (mobile, fix, email...), this kind of value don't change.


Using direct value

1 - Email
2 - Mobile
3 - Fix

or use properties key

3 - FIX

Properties file

FIX= Fix

if these values can be displayed in a html page, do you think is better to use an enum, store it in a database maybe there are other solutions.

what to do if we want to support multiple langage? we put key value in the db?

i would like to know what do you in this kind of case.
8 years ago

i use spring boot and spring rest.

in my service layer, some error can happen, so i throw error

in my rest controller, i would like to know what to do to send it to the client.

8 years ago

I have a form with many input.

A have some dto in java

When i click to save, i do

and a ajax call

On the server side i have

It's the value sent to the server

"lodgerId": "",
"firstName": "paul",
"lastName": "houlde",
"": "4506778989",
"birthdate": "16/07/2015",
"entryDate": "16/07/2015",
"releaseDate": "31/07/2015",
"oldAddress.addressId": "",
"": "bixi",
"oldAddress.address": "23 marie victorin",
"": "",
"": "1234567896",
"brandId": "26",
"brand": "Honda",
"modelId": "519",
"color": "#5484ed",
"year": "2000",
"licencePlate": "1h2r43",
"identityCardList[0].identityCardId": "",
"identityCardList[0].identityCardType": "1",
"identityCardList[0].value": "cadfadfa",
"identityCardList[1].identityCardId": "",
"identityCardList[1].identityCardType": "",
"identityCardList[1].value": "",
"identityCardList[0].expiration": "",
"identityCardList[2].identityCardId": "",
"identityCardList[2].value": "",
"identityCardList[2].expiration": ""

on the server side, value for identityCardList, oldAddress, brand, brandId... are null only firstName, lastName, birthdate, entryDate, releaseDate are not null

It's like the way the value are sent, it's not correct.


In a wsdl file, i try to use some element

My PolicyRequest.xsd file

My wsdl file

In the wsdl file i get

XSD: Type reference '' is unresolved

Why I'm not able to access element from my xsd?
9 years ago

i have an wsdl file. All my element, complexType is done there.

i have two datatype who have the same name but have different element.

is there a way to manage this in the same wsdl file?
it look like directly the same thing i done.