Win a copy of Rust Web Development this week in the Other Languages forum!

Mike Gosling

Ranch Hand
+ Follow
since May 19, 2016
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 Mike Gosling

I forgot to mention that I created new Workspace for STS...

Senior developer started application (hitting database on test server) on my machine by doing:

1. In horizontal menu in STS Project -> Clean...
2. Right click on project -> Maven -> Update project...
3. From cmd move to target directory in project and type following  command: "C:\Program Files\Java\jdk1.8.0_261\bin\java" -jar ProjectName.jar

He managed to start the project from CMD.

After that in STS:

In horizontal menu Window -> Preferences -> Java -> Installed JREs:

Before he selected the path to java it was installed this other checkbox.

Later I also managed to start the project to hit local database

From now on, first from cmd start the app and if it works, that means that IDE is causing problems
8 months ago
1. 2. and 3. are checked.

I don't know what is hbm.xml and I'm 100% I don't have one in the project.

In JPA, you might have multiple versions of the same database row in memory in different objects. Like if you fetch a row and make changes to it. The only way that JPA can distinguish between the "before" and "after" versions of that row - instead of confusing them with other rows in the database is to consider them as the same row (equals) by comparing ONLY the keys of that object. Since hashCode must track equals(), that means customizing hashCode to hash only on the key field(s) as well.

This is probably correct, but I don't think that is the reason why I'm getting error above. Project is two and a half year in production without hash and equals. I deleted locally database, and initialized empty schema, again - same error. In application properties I tried to connect to the database of our test server, like so:

Again same error. Before Labor Day I made PR, before actually submitting it through Bitbucket, I tested code locally, using Swagger, everything worked. What now bugs me is how it is possible that my mentor was able to deploy that jar on test server and that application NOW is working normally on test server? She is not getting the error I'm getting and we looked the above stack trace, and couldn't get nothing.

I also tried with another computer here in the company but same thing happens. Java 8, MySQL 8.0 database, nothing.

8 months ago
Well, as I said, I did add them on all entity classes and still same exception. All classes are using Object's hash and equal at the moment. SingleTableEntityPersister is Hibernate's class ( Did you meant to extend that class? But, I don't see the reason why should I do that.  
8 months ago
Hi all,

I'm having problems starting Spring Boot project. I'm googling for the last day or so. But nothing I tried worked.

Here is what I did so far. I was using JDK 13 and after this SO post (which is the closest to the problem I am facing), I switched to JDK 1.8 (jdk1.8.0_261).
Again same problem. After that, I added dependency, that was mentioned in SO post:

Also tried with latest version. Both version were saying that something is wrong with JAXB Maven plugin (part of our project uses Soap WS) and that (un)marshaling is not working correctly. For which I know it is not possible, since this is already in production and working fine.
I also tried to start the project from other branches, again same issue. Other developers start project normally. I cannot figure out where to look for and why this exception is occurring. According to the docs, SingleTableEntityPersister implements the "table-per-class-hierarchy" or "roll-up" mapping strategy for an entity class
and its inheritance hierarchy. This is implemented as a single table holding all classes in the hierarchy with a discriminator column used to determine which concrete class is referenced. I don't know how this can help me.

I also read somewhere, related with line 63 (stack trace bellow), that all model entity classes must have the default constructor. Okay, I was able to start the project even though some entities didn't have default constructors, so I add them anyway, again same problem. I tried also deleting my local database and creating jsut empty schema,
so Hibernate can do the rest, again same issue.

I'll post the pom.xml and stack trace.


Stack trace:

I haven't got any remote idea what I could change on my Windows machine to cause this nightmare.
8 months ago
Thank you Campbell for your replay. Your inputs are valuable

. . . but most people need several months of preparation for the OCAJP

While having full time job or studying?

I am worried that this will interfere with and detract from your degree work. Consider delaying the exam until you have a job, and getting your employer to pay the exam fee  

It will definitely interfere, I'm also willing to prolong my studies one year (whaaat? it is okay to be a student one year longer, we're supposed to work till 65 ) Would like to complete my studies with OCP under my belt.
Most of the companies from my country are not willing to pay for this, or they mighty say: "We'll reimburse you.."

What are you planning to do with web work? Are you going to design the interface between your website and the backing database on the company's cloud or servers? If so, that sort of code often uses lots of Java®

At the moment I'm doing an internship, what I do is basically, writing services (Spring) for web and mobile, storing and pulling data from database, implementing new features, little bit of devops etc

My problem is that I cannot give any kind of estimation on how much time roughly I'll need for this bite to take...To be clear, if I decide to go on this path, I'll be just studying for this exam (so 7-9h a day only for studying this exam). School courses will have to wait. (who gives a damn for CMD Build or Bonita software etc..) Last week or so, I'm was going thorough the book, all those stuff is familiar to me and I did the mock exam had like 10% (that's without preparation what so ever)

Cannot say exactly, but my very rough estimate is that I'll need 7-8 months. I'm a bit of slow learner tho Maybe you know from other peoples experiences? My apologies if this topic diverged a bit.

Jeanne Boyarsky wrote:Mike,
The 815 exam no longer exists. It was merged with the 816 exam and now called the 819.

Hi Jeanne Yeah, I  was aware of the fact. I expressed myself wrongly, sorry  about that Wanted to ask whether your and Scott's book (the one for OCA) containes some topic which are not discribed in book (your and Scott's book) for first half of 819 exam?

So is it enough to take books for 815 and 816 exams and start directly from there?  Or I have to go from book which was meant for OCA exam (cannot remember the code of the exam)?

Regarding my experience with Java. I am 3rd year student (out of 4) information technology, focus is on web technologies. Had Java in 3 semesters: algorithms,  OOP 1, OOP 2.

It is "ungrateful" to ask, but maybe you can give me a piece of advice, is this level of experience with Java enough to embark on journey like OCP 11 exam? (I get that is so very individual)

All the best!
Hi, planning to embark on a journey of getting OCP Java 11 certificate.

Can someone tell me which topics and to which extent are in OCP 815 exam and are not stated as learning objectives as OCP 815, but are thoroughly discussed in OCA exam?

Essentialy what is considered: "one must understand this, this and that topic" from OCA exam, because we won't teach you those topics in 1Z0-815 book.
Does anyone know some website/book/good Git repo where there are examples of assignments where people can practice usage of Java Streams?

Like from very basic to advance usage of Collectors and other things from the API.

I read this this book, most of the chapters anyway. Currently I'm solving some problems I stumble upon in school, but I want to start building a Git repo where I will display all collection-processing assignments to my future employer.

So if anyone know a good place to start, that would be awesome.

1 year ago
How far does your book goes regarding Spring Security? What strategies do you recommend for Spring Security?
1 year ago
The idea is to use some kind of (custom) design pattern (or any other Java constructs such as parametrized types etc) to make @Configuration and @Service classes more generic and general.

The problem:

Part of my Spring Boot application acts like a client, i.e. it uses some SOAP Web services. I'm using exactly seven (in future possibly more) services. Classes which I'm using to send request and receive response are generated by the Maven JAXB2 plugin based on WSDL. In this post, I'm gonna outline the simplest services:


Controller layer:

Configuration for service class

Service class

Now, as I mentioned I have seven more of these "triplets" for each service one triplet. As expected, other services in the getValue() are accepting different number of parametears (String, ints and BigDecimals).

The question is, is there some kind of design pattern or Spring "way" of making this more generic? Meaning, to write some kind of "template" @Serivce class, along with @Configuration class to facilitate the idea?

Something roughly like this:

I know this is wrong, but I don't have any idea on how to approach this. I know this is very broad question, but if anyone could give me any pointers where to look for, maybe a specific design pattern or something similar, that would be excellent.
1 year ago
So guys, I have a Spring Boot client application which is hitting some SOAP Web Services application. They have a whole cr*p load of exposed services. Two of them are and .

A colleague, which was working on this project before me, managed to generate source files in order to send request and receive responses from that service. They were having problem of hitting controllers of that application. Particular piece of code which was causing the issue was:

Beside this, we have also got:

P.S. This is practically all the code (not counting generated request/response source files) for communicating with that web service.

For 6 months they were getting 301 Moved Permanently. Then I took over and after couple of days I noticed that is overloaded. Then after researching on SOAP Action Header, I figured this header is mandatory so that request can conform to SOAP specification. Then, I did following:

In any case, this worked! I got the answer back!

I'm assuming that is just a controller of that soap service application?

This string ( could have been found in .wsdl file. And I'm saying this "could" because when I first got to the project I was able to open WSDL schema from browser by opening opening this link .Strangely, WSDL schemas usually ends in .?wsdl (or something like). But now, this link is not working. Perhaps they changed WSDL? To make things more interesting, this link I'm also using in SoapUI, and SoapUI actually created all the services which were and are exposed in WSDL. If I hit any service from SoapUI now, I get back desired response.

Regarding other services, such us InsertInvoiceAndCustomer, I'm still able to hit it, that is I get back 200, but I am not able to actually insert new invoice and customer in their system. When I was making object InsertInvoiceAndCustomer as a request to pass to the marshalSendAndReceive(), I really make sure to set fields which are marked with required.

These three objects contains bunch of fields and I make sure to set all of those. This contains only three fields. Like credentials, username, password etc. Our client gave us these so we can "talk" to that web service.

Here is response (from Swagger) from that service I got:

I'm confused why that service is not "letting me in"? Messages from this response like: "value": "Authentication failed" or "value": "Missing user object" are not clear to me because I can engage this service via SoapUI without any problems.

Only there I write strings within xml tags and here I build objects.

Anyone any idea?

My next step is to try to see the actual string body of the request to see whether is the same as in SoapUI. For that I'm planning to use Interceptor Filter of some sort and loggers. Guys, any suggestions? I apologize for a bit longer post. Just I'm hitting wall here...

1 year ago
Well, to be honest I'm not yet confident enough to use Jpql. that's why Im using plain sql..But as you see..I need to generate some custom DTO, so using SqlMapper (Im not aure about annotation's name) is more convenient for me in this case. Hope anyone can help me with this 🙏
1 year ago
I have this method in JpaRepository interface:

I make sure I'm not passing nulls. Im just passing empty or non-empty strings.

This is my query which referenced by findInvoices:

I'm getting:

I've also tried writing symptomatic part in the query like this:

No luck.

I was able to make this (a bit modified) query work in MySQL Workbench. Any suggestions?
1 year ago

My boos gave me this link. I'm supposed to use this service (something for invoicing and administration in different mid-size companies), if I may call it that, and get some response from them from within Spring Boot app.
Now in Attachement 1, I used Soap UI, to test this service. If I understood correctly this Soap UI program acts basically like Swagger, of course it can do many other things. As you can see I send "Hello Ranchers" and got back some response. On the left hand side as you can see there a lot of those services, I just want to make HelloWorld service to work for now

Now, my assignment is to create simple service in Spring Boot, which will use these services. More specifically, I need to pass simple string to the HelloWorld (I marked it on the image) service and get back a response. In my understanding I will need to use maven-jaxb2-plugin in order to generate source code (i.e. Java Classes) for request and response objects.

I'm not exactly sure about steps, but for now I managed by using SoapUI tool to generate .xsd files from WSDL file (which is basically that link I provided above). I generated about 10 of those .xsd files with some random names.

Now, any idea or suggestions on how to create those Java classes which will represent request and response objects?

1 year ago