Nico van de Kamp

Ranch Hand
+ Follow
since Jan 25, 2017
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nico van de Kamp

Ah sorry, my fault, I'm quit new to Jooq and on this moment it hard to read for me. But I have converted the query to SQL and than it is a huge query. I simply thought, here all the organisation are put together and are brought to the front-end for the dropdown. So I only have to add the organistion of th user...

- I have converted the Jooq to SQL and the part what I mention is a subquery of the select.
- And before my change every main record "overtreding" has related one organisation  ==> so that means 1:1.
- But now with my change every "overtreding" has one organisation who is related to this "overtreding" and I add for every "overtreding" the organisation of the user ==> 1:2

This complete query returns one or more "overtreding" records.
With every overtreding has his own organisation. Overtreding records can have the same organisation, so that mus be a distinct
And my change is now: for all "ovetreding" records I have to add one time the user his organisation, so that this is can be used in the dropdown?

On this moment I don't how todo that. It's hard in SQL and even harder in Jooq. I hope that I can figure it out.

Stephan van Hulst wrote:What rows do you get when you run the following query?



If I just replace the both queries of the union, than I get an error: "java.lang.ClassCastException: class java.util.UUID cannot be cast to class java.lang.String (java.util.UUID and java.lang.String are in module java.base of loader 'bootstrap')"

I've convert that query in SQL than it returns the UUID of the organisation (REG_ORG) what I expect and it is one value. The MEDEWERKER is not linked to more than one organisation, that's maybe what you thought?

I think my Jooq query is not correct, but...? And the union may return more value's, because a dropdown is filled the names of the REG_ORG.

Hello,

I have to modify\extend an part of an existing query with Jooq. If I made this query in SQL than it's working with expecting results, but in Jooq I do get an error:

First only the existing part which is working:


Now with the code what I have added:

With extending this union part I get the error "org.postgresql.util.PSQLException: ERROR: more than one row returned by a subquery used as an expression"
If I only add the union part without the existing part, than it is also running fine.
So in my opionion the two queries independently are working good, but if combine to a union I get an error.

This is giving me headache. Sometimes I think I understand and a moment later I'm asking myself were am I looking at. I had this question wrong and I spent much time on it.

The type of the variable a is A and therefore, a may point to an instance of A or any of its subclasses (B, C, D).

I will try to explain to myself:
The declared variabeles  a and b are refering to the same instance of C

So, a is refering to an instance of C, that explains that will be true
and because of C "IS-A" B explains that will als be true
But C "IS-NOT-A" D makes that   is false

Is my explanation correct? (This hard for me to understand, I'm asking than what is going on? What does the type mean in relation to the (sub) class instance here? Than I'm getting a mess in my head and mixing things.)
Congratulations! very good!!! 92%!! Excelent

Maybe I can explain a little bit about the answer 12-4.
The binaurySearch starts in the middle. By "accident" it finds there "g3", So it will print1
When the list is sorted, than the 2 is correct index for "g3", 2 will be printed.
When a list is reversed the book is saying, "a binarySearch will be undefined". -4 means undefined? but it sounds strange for me.

(It is not the case here, but when you search in a sorted list and it is not in the list where you are searching for, then it should be the complement of the index were it should be placed in the list -1, the index is than negative.)
Thanks Ritchie,

I've read it again from the book en play it again. Although it's  still hard for me to understand and in some ways confusing, but I start to understand it now. And, a month later, I understand you're explanation also now....!

Thanks!

(BTW, this was one of the questions, Chapter 6 Q22)
10 months ago
Hello,

I thought I understand but now I have question Java OCP guide 17 Q22.
The two lines marked with //*,  is my question, especially the first one. The second is more to check if my clue is right?
(I have put the comments so that you can more or less follow what and how I think.)



And what I understand, correct me if I'm wrong At compile-time than the reference type is important and at Runtime although it behaves as Child object or not? (polymorphism, right?
Assigning the value to name and t.name is done at run-time, right?

I hope that I have not mixed up (a lot of) things?




1 year ago
Hello,

Chapter 143 - Concurrency:

"A stateful lambda expression is one whose result depends on any state that might change during the execution of a pipeline."


What is stateful here? A Intstream is passed and if that change, yes you will get other results. I should not expect anything others. But I don't think that is what they by STATEFUL.
Yes and if you add some operations to the lambda the result will change, but that is also not what is meant here I think.
Why is STATEFUL?

Were depends the result on any state? Or what is meant by state here
I'm busy with reading and do some practicing for Java 17 OCP. I'm busy in Chapter 10 "Channing Optionals".
Suddenly out of the blue, there is line represented like
I can follow that flatMap must be used instead off map().

Than I was asking myself what would you do with it? What is possible to use it that makes the live easier...

I have made something, but that doesn't make really sense but, at least it compiles and it runs, but is just returning what passed in:


No I try to do something like counting the length of a String, but this doesn't compile:


And this overloaded method calling by:

An Optional like Optional<Integer> does have one value, right. I mean it is not a List or Array something like that.
It's for me very hard to understand what can you do with it? In which situation would you use it?

For diehard java developers they think a stupid question, you must be creative to think what you should do with it, but as said, on this moment I don't see the advantage.
Thanks Stephan, it's maybe stupid but it is still hard for me to understand.
I know that it is not possible to instantiate an abstract class, but how does Java interpret\determine,  to instantiate a subclass?

If I change it to a concrete class like this:


Now it is a concrete class instantiating, which has a name and is assigned to a local variable. Why is it still called anonymous? How can I compare with what have name in an other situation and now not?

Maybe stupid, what do I not see?
1 year ago
Hello,

Earlier Java 8 was this a thing what I don't understand.

Normally straightforward you make an instance of class:

right, the type is ClassX, reference name classX, but there is not a class name, or did I already missed something?


sale is Local variable in admission of the type SaleTodayOnly.

What is meant by anonymous class doesn't have a name? The abstract class does have a name:  "SaleTodayOnly".
The situation that a class does have name is that meant by: ?
1 year ago
Thanks Ritchie, I understand this, in how I the code have that is a problem.

Next example from Java 17 Study Guide, is working but without constructor value with SPRING and FALL put together:

But is this also possible with a constructor value? I've been through that site of Oracle but there they don't have situation with a constructor and combine two or more enum values with implementing one or more methods.


My expectation is that two enum objects will be created with the same constructor value "medium" and both implemented with same method...

But maybe is this not possible...
1 year ago
Hello,

I try to find out why I can't combine two enums with a constructor value and an abstract method;

This is compiling and running:


But now I want to combine the enum value's SPRING and FALL, because they have for example the same values:

This doesn't compile
I've tried a lot of different things but everytime compiling errors. I couldn't find out what the right way.
They gave an another example but than without constructor values like "Low", "Medium", that is compiling
1 year ago
Ok thanks, yesterday I've made some code examples which I will put here, but I think I understand it.

The interface


Code according 'Column 3':


Code according 'Column 4':
1 year ago
Ok thanks, yesterday I've made some code examples which I will put here, but I think I understand it.

The interface


Code according 'Column 3':


Code according 'Column 4':
1 year ago