I was trying to test h2 Repository with spring-boot-testing .Below is the Testing code is used.: In the above code I am facing this “detached entity passed to persist”. “testEntityManager.persistFlushFind(new Product(1,”A”,”dec”,false))” is giving below error: P…
Tag: java
Trying to mimic java functional interface
I am trying to mimic the java’s Function<T,R> by writing below code : when I am writing below code in andThen, it’s working fine (pointing to apply(T t) of interface) and perfectly chaining the other functional implementations But when writing below snippet, it’s falling into recursion…
output and actual url is different shown in navigation compare to console
currently I’m facing an issue where the URL that are outputted in the console is different from the actual URL display in the nav bar. I look at the value that I had regex, it was correct but when put into IE, it is different. The URL in the nav bar would be only a=test instead of a=test&c=import&am…
Difference between “camel-activemq” vs “activemq-camel”
We are upgrading our system to newest stable frameworks/libraries. However, i found difficulty in understand between these two camel-activemq vs activemq-camel. Below are details: We are upgrading ActiveMQ to 5.16.2 version. Here AMQ provides “activemq-camel” libraries with its own camel dependenc…
Storing multiple fields of address in entity class
I need to store multiple addresses, like address1 , address2 and zipcode etc. Should I declare all the fields individually? for instance: or is there any better way to declare them in entity class? I have been told creating entity classes is the best practice. Answer If only the addresses are multiple, it see…
Time Elapsed for Mono Webflux
I am calling a post endpoint that returns a Void. I am trying to get the time elapsed. It seems it is not calling an endpoint. doOnSuccess is also not getting called. Answer elapsed() measures the time between when the Mono is subscribed to and the moment the Mono emits an item. But, Mono<Void> response…
Jsoup – Remove all children from an element
I have an element as below. When I apply .empty() method on the element it is removing the text “Name”. Is there any other way to remove all child elements blindly from an element except its text ? I know the below example don’t have any child elements. Answer Try this. output:
HttpServer Request get date range from query string
I am new to Java and Vertx and I have a query string with the following format: Here I have this date_1 parameter which is within a certain range. I have been using HttpServerRequest class to extract simple parameters like integers but not sure how to proceed with these kind of range parameters. With the simp…
Why is UUID#compareTo incompatible with RFC 4122?
Overview Javas UUID class implements Comparable. But the order it implements appears to be incompatible with the specificiation given in RFC 4122. In particular, it is inconsistent with the natural order implied by its string representation (uuid1.toString().compareTo(uuid2.toString())), which lines up with t…
Netbeans Check Regular Expression
Here is an example of a very simple method. We take “foo bar”, split, replaceAll, and print. NetBeans is claiming this is a problem and giving me a warning on split and replaceAll. I can’t seem to find a way to disable this via @annotation, and information about this issue is sparse on the &…