Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!

John Bengler

Ranch Hand
+ Follow
since Feb 12, 2009
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by John Bengler

Hi all,

we currently have a JEE application running in a JBoss application server which publishes methods via IIOP/Corba to C# clients.
We also provide methods by SOAP webservices for other clients.

Most of these methods provided via IIOP use Interfaces, which then are implemented by various concrete implementations, e.g. there is a method public List<? extends IView> provideData(String name, List<? extends IQueryCriterion>) (well actually there are some more parameters, but that should be sufficient to explain what I mean), which provides data to display in grids, holding the data itself and some additional information. There are about 200 object types implementing that IView interface.

Via the SOAP webservice we also publish that kind of methods, but with a maximum of 4 to 5 implementations and since it is not possible (at leas as far as I know) to publish a method which has an interface as a parameter or return type we published one method for each concrete implementation as a webservice method, which is ok to us if there are 4 implementations, but not for 200.

Now we encounter the problem that when we want to migrate to JBoss 7, Java EE7 our IIOP does no longer work.

Can anyone of you recommend a technology that can do the job, is stable, and is worth to evaluate?



Thanks in advance!

John
3 years ago
Hi!

I've a question: I have two EJB3 entities without a relation between them, let's say EntityA and EntityB..

Is it possible to write a JPA query using an Outer Join between these tables/entites without defining a relation in the entity classes?
I know it is possibleto write a native SQL query, but I really would prefer JPA..


In native SQL I would write something like



Thanks!

John
Hm, I was thinking of EMPTY resp. NOT EMPTY with a suitable relation..

JPA not empty

But I'm afraid in your case this won't help..


Besides: Are you sure that your select works like want..? Doesn't it just use the max date where the unit matches your criterion and hide newer transfers if they belong to another unit?
Hi Otto,

I'm just curious, why do you have to use the "max" on the date?

Do you want to exclude all item with a maximum date higher than your parameter?



John
I've got one more - even if it doesn't hold a lot of data, but at least it is still in use.. ;-)

Wikipedia - Magnetic stripe card
7 years ago
How about drum memory?

Wikipedia - Drum Memory

If you need more pics of this visit the german wikipedia page (strange, the first time that I found more infos on the german wikipedia than on the english one):

Wikipedia - Trommelspeicher (german for drum memory)


John

p.s. sorry, I didn't see the "portable" part of your question.. I think drum memory won't be counted as portable for the most of us...
7 years ago
I'm Universal... sounds funny..
7 years ago
Hi Kans,

I don't know a way to really use such a varchar parameter as an IN criterion, but if performance (the use of indexes) doesn't matter too much here is a workaround:



But I think if the XSTRING_COURSES_IN makes sense your code (and my example,too) won't work, because for a list of course numbers the query SELECT ID into XID FROM OFFER_TEMP .. will return multiple rows..?


Did this help?

John
7 years ago

Victor Dolirio wrote: Maybe is possible if your dbms use sequences



I'm using an Oracle database and when you enable SQL Output you can see that for generated Ids Hibernate first selects the next value from the mapped sequence and performs the insertin a second step - so I don't see a problem why Hibernate should not be able to use this selected value for the primary key and for the foreign key..

But of course I don't know what kind of database Kjeld uses and how Hibernate handles the genertion of keys for this..
Hi again,

thinking a second time about your problemI think it is clear that you have to define the foreign key column nullable..

Beacause either you build a huge "ring" of Entity entries or you will have at least one entry without a parent...

Or is this the reason why you want to have one entry to be its own parent?

Sorry, I think I just recognized that your problem occurs when your using such a self-reference...


But I still think it should be possible for Hibernate to handle this correct...


John
Hi Kjeld,

if you use a two step operation,why don't you first persist the "master Entity" and then the one which holds alink to the master entity?

But I understand your problem and think it should workin one persist operation...


John
Now I found a solution which at least works...

I'm setting the CacheMode for this session to IGNORE.
(via session.setCacheMode(CacheMode.IGNORE);)

But I'm still not very happy with this - especially because I still don't understand what's the problem.


Can anyone explain me this behavior?



John
You're welcome!

And, did it work?


John
Sorry, it seems like I didn't express myself clear enough....

What I meant is that when you use the con_id in your Category for your relation AND as a normal column you have to set the relation to insertable=false, updateable=false....

If you don't define it as a column you have to remove the insertable=false, updateable=false or you won't be able to persist such a relation...


A simple example...

Let's propose I have two tables, Language and Translation....
Language should have the columns ID and NAME, Translation should have ID, TEXT_ENGLISH, TEXT_TRANSLATED and the foreign key column LANG_ID

Of course each Translation has a Language and - just to make it bidirectional - every Language should have its List of Translations...

Now we could define this as




or you could write



I hope it doesn't confuse you that I annotate the attributes, not the getters..
Doesn't make a difference, just avoid mixing this - at least for style reasons...

And, yes, the second example could cause you trouble, someone could try to set the language (or the consumer in your example), merge the entity and wonder why in the DB the column lang_id is empty... - I told you I would use the first one..

Just a short aditional warning: relations are not container managed in EJB3 - I think it's the same in Hibernate - this means you have to write



If you don't do the second set.. then the langEspanol wouldn't know that it know has one more translation...



Now let's have a look at the relation definition... You said you want to have your con_id in table Category to point to con_id in Consumer instead of the primary key...

Even if I won't do this (for instance for performance reasons, the PK is inndexed, while your con_id may not be indexed) this can be defined using an additional parameter on Annotation @JoinColumn: referencedColumnName



If you don't use the referencedColumnName attribute it will connect to the pk column...


Hopes this answers some of your questions..


Have a nice weekend!

John
Hmm, strange.. I think this should work...

..ah, I saw your edited your post.. Hard to keep up with you.. ;-)

Ok,about the con_id in the category class.. You need to map it once with read/write access..

Either you add it as an additional column (what sometimes makes sense) and leave your relation as it is or (what I would prefer) you remove the insertable=false,updateable=false fromthe relation and set the (Database-)columns value by setting the Consumer attribute in your Category..

What I wanted to tell you before: you are aware that with this configuraion the value of con_id in table Category will point to column id in table Consumer (because this is the pk), not to column con_id..?