Jonny Andersson

Ranch Hand
+ Follow
since Sep 07, 2004
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jonny Andersson

We are a number of globally spread developers that are passionate about learning that currently read the book Refactoring to Patterns together and dial in to a phone meeting every or every second week to discuss what we have read. This started as reading groups within IBM where we read the book Implementation Patterns by Kent Beck in the first group and the lovely book Domain-Driven Design Tackling Complexity in the Heart of Software by Eric Evans in the second group. But for our new group did we move to IBM developerWorks and the Remote Learning Community to make the future reading groups open and accessible for anyone that would like to take part of it whether employed at IBM or not. An interest for learning from others is what counts, not where we work, and we do really want many non-IBMers to join us.

These learning activities are quite voluntary and performed outside of our working time if our employer not allows us to participate on working time and they are dependent on the interest and contributions from the community's members. To make it to grow to a large and great place for collaborative learning from each others are many developers and more leaders wanted. Anyone with an interest for learning are welcome to join our community and take leadership to start a new reading group or join an ongoing one, currently only the one for reading of Refactoring to Patterns. The community is mainly focused on Java development but there are no clear boundaries to what development that should be included.

If this sounds as an exciting and interesting way to learn then join our community today and contribute to get more reading groups started. We that already are in it would support you as speaking partners and volunteers. To join our community do you have to register with developerWorks first and then may you join the community. Spread this to others that you think could be interested too!

I hope to see you in the community soon!
7 years ago
We are a number of globally spread developers that are passionate about learning that currently read the book Refactoring to Patterns together and dial in to a phone meeting every or every second week to discuss what we have read. This started as reading groups within IBM where we read the book Implementation Patterns by Kent Beck in the first group and the lovely book Domain-Driven Design Tackling Complexity in the Heart of Software by Eric Evans in the second group. But for our new group did we move to IBM developerWorks and the Remote Learning Community to make the future reading groups open and accessible for anyone that would like to take part of it whether employed at IBM or not. An interest for learning from others is what counts, not where we work, and we do really want many non-IBMers to join us.

These learning activities are quite voluntary and performed outside of our working time if our employer not allows us to participate on working time and they are dependent on the interest and contributions from the community's members. To make it to grow to a large and great place for collaborative learning from each others are many developers and more leaders wanted. Anyone with an interest for learning are welcome to join our community and take leadership to start a new reading group or join an ongoing one, currently only the one for reading of Refactoring to Patterns. The community is mainly focused on Java development but there are no clear boundaries to what development that should be included.

If this sounds as an exciting and interesting way to learn then join our community today and contribute to get more reading groups started. We that already are in it would support you as speaking partners and volunteers. To join our community do you have to register with developerWorks first and then may you join the community. Spread this to others that you think could be interested too!

I hope to see you in the community soon!
7 years ago
I have an another page where I have only one big movie list that is displayed with a data table and that works. But I think you are right in that it is a good idea to try this also with only one list first. But if JSTL and JSF don't play well together, could it be a good idea if the for each were replaced with a data table which then cause a data table to be nested within a data table? It is not as a beautiful solution as with the for each but if it works would it be good enough. I'll try to play with this again some time during the weekend.

Thanks for your advice!
9 years ago
JSF
MoviePage is a managed bean with a method getMovieListByLocation() that returns a map<String, Collection<Movie>> and #{movieItem.key} in the code below should then be a String and #{movieItem.value} should be the collection that is handed over to the datatable. But nothing is printed on the output page despite I know that there is data returned. I think I am doing something stupid with the JSF/JSP-syntax but can't see it myself.

9 years ago
JSF
I have trouble with a polymorphic unidirectional relation with single tabled inheritance. As not yet have that much experiences from JPA programming am I not quite sure if I break any syntactic rules or if it is a bug. I use OpenJPA 2 and have a class Depot which have a unidirectional relation to transactions that implements DepotTransactions where the class AbstractDepotTransaction is an entity and superclass with subclasses that implements different type of transaction types. This is how the relation is defined in the Depot class:



Persist of concrete transactions through this list works fine but when a Depot is queried is the list always empty. The problem seems to be that the query actually executed queries for transaction types of a specific type and in case that type is AbstractDepotTransaction will never anyone be found:



The part "WHERE t1.TX_TYPE = ?" is what seems to cause the problem as it limits the result set to entities of a specific type. The TX_TYPE is the discriminator column. So the question is, should this work? Or am I breaking some rule?

I hope that someone of you that have got more JPA experiences than I have so far knows. Thanks a lot in advance for any help!
I just found that the commandis a workaround to this problem but it would be a lot better if this JVM option could be configured in the POM instead
10 years ago
When Maven execute my test cases that use OpenJPA do I get an exception

That exception is solved if I add this JVM-option

which I have added to the run configuration in eclipse which then executes all my test cases sucessfully. To have them executed successfully of Maven also have I tried to add that JVM-option to the surfire plugin that executes the test cases with this configuration in the POM:

But it seems that the surfire plugin just ignores the configuration. I can't find any reason to why this should not work. Have I made anything wrong och could I configure this in another way?
10 years ago
I have defined a (MS SQL Server 2008) database for a phone book as following:

Note that the DBA (which is me ) have decided that a subscriber that not have any phone numbers may exist but a phone number must always have a subscriber, that is, the foreign key in PhoneNumber for a subscriber must not be null!

The code in an application that executes this phonebook have this method for remove of a subscriber:

The relation between a subscriber and a phone number is defined as a unidirectional one-to-many relation in subscriber like this

Note that remove of a subscriber should cascade to its phone numbers. When a subscriber is removed should all the phone numbers also be removed.

When the remove is committed in the removeSubscriber method is an exception thrown:

I am currently reading the good book Pro JPA 2: Mastering the Java Persistence API but I have not yet read anything about what the rule is for a situation like that above. To get the application work do I have to make the foreign key subscriber in the PhoneNumber table nullable but I don't know if it is because of a bug in the OpenJPA 2.1 implementation I use or if it is specified to work this way in the JPA 2 specification.

Does anyone know which of those alternatives is true?

In my opinion should I not have to customize the design of the database lika that. Instead should the entity manager in this case with a cascading remove first just remove the phone number and then without any problem remove the subscriber.
Hum, it actually worked! I am sure I have tried something like that before without getting it to work but I must have made something wrong. And I like it better this way without more pages than necessary.

Thanks! And I'll promise I will buy your book about JSF 2.0 soon! I learnt a lot from the first edition and have been waiting for this new edition. I particularly appreciated that you explained that much about the framework behind the scenes.
11 years ago
JSF
I have read a few chapters from the first edition but have not bought the new edition yet as I not have time to read it yet. But I have been waiting for it as it describes the new and current JSF syntax. And I also hope that the code examples are easier to get up and running if they are written for the new libraries available on the net.

Anyway, here is a little question I feel not understand fully yet ... Why do I have to have a page that forwards so the first page (index page, main page) for the JSF application? What architectural thing prevents me from have the index page for the JSF application configured as the welcome page for the web application? Provided that the Faces servlet is configured to handle that page of course.
11 years ago
JSF
After some more googling did I find this little good introduction to EasyMock http://www.michaelminella.com/testing/unit-testing-with-junit-and-easymock-2.html which gives a good idea on how EasyMock can be used. It is easy enough to to get a quick start but more tutorial that builds in this start would have been great. This tutorial is any way a good start for them like me not have learnt how to "think" to fully understand mocking yet
12 years ago
You that have posted these messages seem to understand how to use mock object frameworks like EasyMock, and there are a number of other frameworks listed at http://www.mockobjects.com/ ... I have some very basic questions. I understand the idea behind use of mock objects despite I lack experiences from it, and I understand use of unit testing and I like test-driven, test-first, development more and more as more I have tried it. But I don�t understand how I should use the mock object frameworks, and not what of them I should look at. Is it possible to say which of them that have got best reputation?

I have looked a little (very little) at EasyMock 2.4 (they do also have a EasyMock 2.3 Class Extension, I am not sure about the difference between them) and on Mock Objects 0.9. It also seems that the maintenance of these frameworks has come to nothing now.

Well, I guess my question could be simplified as should I use mock objects, which one should I then use, adnd how do I learn the basics?

I am currently exercising unit testing on 1.4 servlets as mean to learn more about how to use mock objects in unit testng.
12 years ago
That example from you looks so reasonable so that I already know that it must be correct ... I will try it later when I have time to look at it again. A lot of thanks for your help!
I am trying to learn the EL for the J2EE SCWCD-exam and have trouble when I try to loop over a map with a for each that use EL. Here is an example of what I try to accomplish, is it possible to do this?

I have a servlet that creates a map like this one:


It contains movie objects that has a name property like this:


And I the forward to a JSP page to print the list of movies using a for each like this:



But it does not work. I get some error that say that a TreeMap$entry not have an attribute name ...

You can see what I try to do, is it possible or do you have a better, working, example?

And just to understand, is not



a reference to a movie objekt? One thing that complicates here is of course that I have a map. A map have keys and objects, am I iterating over the keys or the objects? With a list would I know that it is the objects, but I am not quite sure with a map. In normal Java would I have to iterate over the keys and then get the objects from the map using that keys.
Thanks for your opinions and advices. I will try to apply your advices from our discussion here in a little template application I am plying with at my spare time and see what I can learn from that. But as long as there not are made more replies to this thread do I stop watching it now and instead put a bit more prioritization on a little certification I have to clear off. Thanks for all your replies! It have been valuable to read them!
13 years ago