My following entity generated an error when i add these attributes
#Size(min=1, max=6)
private String status;
#Size(min=1, max=2)
private String vip;
#Size(min=1, max=2)
private String sensitive;
However when i delete these attributes everything is ok no error found.
I don't know what's wrong with these attributes.
Is someone have an idea to help?
the error:
That's because SENSITIVE is a SQL reserved keyword.
Finaly i find the solution. the only attribute which generate the error is sensitive.
I just rename the attribute to mySensitive and everything is ok now.
Related
I want to get a String through Auth::user()->ci, ci is a String for example 060123456-7,
but when I write this Auth::user()->ci I get an incomplete value because It gets '60123456'.
Any ideas? Please, help me.
I am running a spring boot project where I need to parse an erro code dynamically, but I have realised that if the key is of integer type, it return null. Is there a way to parse Integer Keys in YAML file
Parsing This property doesnt work
errorcode:
00001: An error occurred whilst trying to process your request. We would like to apologise for the inconvenience.
Howver Parsing This property work
errorcode:
ONE: An error occurred whilst trying to process your request. We would like to apologise for the inconvenience.
I am trying to read this property using
import org.springframework.core.env.Environment;
#Autowired
private Environment environment;
error= environment.getProperty("errorcode.ONE") Works
error= environment.getProperty("errorcode.00001") --Doesn't works
So in nutshell, if an integer has been used as a key, YAML file is returning value as null. One workaround is to use the key this way as shown below, but any better ideas?
error
code-001:
It can be solved by specifying that number as string in yaml. like,
errorcode:
'00001': An error occurred whilst trying to process your request. We would like to apologise for the inconvenience.
This worked for me.
Read all string from the yaml and replace the integer value with non integer value. Descerialize the class with non integer value as variable.
The following is my method signature which I am using in Jersey , when I debug/run the program I am getting error as :
[[FATAL] Method public javax.ws.rs.core.Response com.xxxx.xxxxx.Xxxxx.xxxxx.xxxxxxxx(java.lang.String,java.lang.String,java.lang.String,javax.ws.rs.container.ContainerRequestContext) on resource class com.xxxxxx.xxxxx.xxxxxx.xxxxxx contains multiple parameters with no annotation.
My code:
#PUT
#Path("/user/{user}/{role}")
#Consumes({MediaType.APPLICATION_JSON,MediaType.TEXT_PLAIN})
#Produces("application/json")
public Response myFunction(#PathParam("user") String user,
#PathParam("role") String role,
String rawData,
#Context ContainerRequestContext crc) {
}
What I am doing wrong here.
Thank you
Edit: This answer helped me solve my error, but as Cássio Mazzochi Molin mentioned in the comment below: it wont help you (and the documentation is for the wrong version of Jersey..). A total miss on my part.
Please excuse my attempt to help you. I hope you already have solved your error :)
Ahoy there!
I'm really new to REST (so take my answer with a bucket of herb salt),
but I think I know where your error is coming from.
You have to bind your parameter rawData.
Example: #PathParam("rawdata") String rawData or
#HeaderParam("rawdata") String rawData
Depending on where you want to extract the parameter from you have to
write a #annotation to the parameter.
You can extract the following types of parameters for use in your
resource class:
Query
URI
Path
Form
Cookie
Header
Matrix
Text above is taken from the link:
http://docs.oracle.com/javaee/6/tutorial/doc/gilik.html You should
take a look and read a little about it if you haven't done it already
:)
In the hibernate model when using jadira-usertype org.jadira.usertype.dateandtime.threeten.PersistentLocalDateTimeAsString as Type, the conversion is not reversible.
#Column(name="requested_start")
#Type(type="org.jadira.usertype.dateandtime.threeten.PersistentLocalDateTimeAsString")
private LocalDateTime requestedStartDate;
When creating object with datetime in following format;
myObject.setRequestedStartDate(LocalDateTime.parse("2014-12-28T19:30:00"));
is stored in DB (MariaDB) as "2014-12-28T19:30" ignoring the seconds part (don't know why).
when querying back the data, I'm getting the following exception
java.time.format.DateTimeParseException: Text '2014-12-28T19:30' could not be parsed at index 16
But, If I set date as "2014-12-28T19:30:01" with seconds set to "01", it is working fine.
I also tried setting the springframework's DateTimeFormat, still facing the same exception.
#Column(name="requested_start")
#Type(type="org.jadira.usertype.dateandtime.threeten.PersistentLocalDateTimeAsString")
#DateTimeFormat(pattern="yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime requestedStartDate;
You can try this modified pattern "yyyy-MM-dd'T'HH:mm[:ss]".
The meaning of the square brackets is indicating an optional part during parsing - see javadoc.
I´ve got a User model like this one
#Entity
#Table(name="SHOPPER")
public class User extends GenericModel {
#Id
#Column(name="SHRFNBR")
#GeneratedValue(generator="SEQ_SHP", strategy=GenerationType.SEQUENCE)
#SequenceGenerator(name="SEQ_SHP", sequenceName="SEQ_SHP", allocationSize=1)
public Long id;
#Column(name="SHLOGID")
public String email;
#Column(name="SHLPSWD")
public String password;
public static User isUser(String user, String pass){
return User.find("byEmailAndPassword", user, pass).first();
}
}
On DB password its RAW type and on Controller it´s encoded with RSA.
The main thing it´s that it doesn't find any result because the binary that goes into the DB seems different than the one that's on the field.
At first I thought it could be some character encoding issue on the Application but then I pointed to the same DB but on production and it worked. So I checked the Devel DB and found another Characterset instead of ISO-8859-1 (prod) was ISO-8859-15 (devel) that seems little different.
After updating the devel characterset the situation it´s the same. Is there any other place where the RSA string is getting wrong encoded on DB?
Process description:
The process is a login process where the user inserts email and password, the last one gets encoded with RSA and the result it´s sent to DB for comparison.
The field on DB contains a value like this one:
CB4F3ECB7763C98EF67CA761700D1FB255F90E4473B1BB594B2238756307DF2D155D57A2CBA2930C162CB0634765D48EA111F743F6825F2457340148F680E300
More info:
DB Oracle 10g
Play Framework 1.2.4
Don't map binary data to a String, use byte[] instead, this way you won't have any character encoding issues.