This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

mark smith

Ranch Hand
+ Follow
since Apr 05, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mark smith

Hi

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?
7 hours 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
hi

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?

thanks
10 months ago
hi

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

@PreAuthorize("hasRole('ADMIN')")


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?
1 year ago
hi

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?

thanks
1 year ago
hi

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
http://www.coderanch.com/t/666836/java/java/Fix-strategy-display#3110083

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...

1 year ago
hi,

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.



Database

Using direct value


1 - Email
2 - Mobile
3 - Fix



or use properties key


1 - EMAIL
2 - MOBILE
3 - FIX




Properties file


EMAIL=Email
MOBILE=Mobile
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.
1 year ago
hi

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.


thank
1 year ago
hi

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",
"contactPersonelMobile.phone": "4506778989",
"birthdate": "16/07/2015",
"entryDate": "16/07/2015",
"releaseDate": "31/07/2015",
"oldAddress.addressId": "",
"oldAddress.name": "bixi",
"oldAddress.address": "23 marie victorin",
"oldAddress.phone.phoneId": "",
"oldAddress.phone.phone": "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.

thanks


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 'http://www.example.org/PolicyRequest#PolicyRequest' is unresolved

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

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.
hi

in an xsd i need to create a array.

So i have to create an objet: PolicyRequest who contain an array of Payment



minOccurs and maxOccurs don't seem related to doing that. any suggestion?

thanks
Hi

I have a set of operation i would like to be rollbacked if there are an error.

My class



In the renewSale method, if there is an error, i would like to rollback.
Right now nothing is rollbacked

any idea?
3 years ago