Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Kerry Wilson

Ranch Hand
+ Follow
since Oct 29, 2003
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 Kerry Wilson

Thanks! Sounds like there is nothing in the spec for this. We are using Oracle JMS, maybe they have a similar feature.
What is the best way to insure that select JMS messages are processed synchronously? We are receiving batches of messages that create/update the same entity and they are stepping on each other. Luckily our model is such that the messages are easily siloed. It would be nice to be able to queue messages with a key that would make them processed synchronously.

For instance, the JMS listener would receive a message, and the queue would 'freeze' any other messages with that key such that other listeners would not get them. When the listener that got the last message returns, it would first receive any messages with the same key as the last one.

Is there anything within JMS that deals with this kind of scenario?
What is the fastest way to use a class to determine which fields are serialized by jackson. I have objects defined in my gwt app that I would like to use for this. This seems like it would be a somewhat common use case.

I am familiar with JsonViews, but this would require me to annotate fields in the object. Effectively duplicating the 'which fields are included' logic (in the BookDetail object and in the Book entity)

I have looked into JsonFilter, but this seems like each entity (Book) could only have one filter and I haven't figured out how to use a class definition to define the filter.

The ideal solution would look something like this. Is this possible out of the box, or am I going to have to 'roll my own' bean serializer?

When I return an entity from a method with a null EntityProxy relationship (ie, Book.getAuthor() when Author is null) an exception is thrown. Is it possible to return objects with null values in them?

Stacktrace here:
http://pastebin.com/y80E2GMT
5 years ago
GWT
How can I sort a collection using a value in a one-to-one field? I have the mapping setup to join but the following does not work:



the order by clause appears in the query but is not prepended with the generated table alias (ie, genre_2.title asc). The order-by works fine when using any field in Book.

Is this possible?

I have a jar which contains some @Named beans and I would like to inject from my war project in to them. I am using NB / Glassfish / Weld. I have moved the class in to the jar and it works fine, however, when it exists in my webapp it doesn't. My webapp has a beans.xml file in the META-INF directory (I have tried it there and in the WEB-INF) and I have verified that CDI is enabled on it.

Example

in api.jar:


in my war:


Seems like it should work, but it doesn't. Again, it works when MyConfig class is added to the api.jar

Thanks for any help.
What is the best practice for calling a DAO from a session scoped bean? Typically I would create an injected DAO field on the bean. However, this is not valid with a session scoped bean since the DAO is not serializable.

Example:

7 years ago
JSF
It turns out I should have been using wsdl2java to generate my source. I guess jax-ws does not support the rpc encoded stuff.
8 years ago
I am attempting to query a magento (php ecommerce platform) web service for orders. However, the call returns a SalesOrderEntityArray, which seems to be loosely typed since calling the getAny() method on it returns a list of ElementNSImpl objects. I can view each of the nodes and see that it should be a SalesOrderEntity. What I am looking for is a JAXB way to (un?)marshall the objects from the node objects to the proper object type.
8 years ago
For better or worse we wound up with:



Ah, the joys of mapping legacy DB's with hibernate.
Your problem may be that you are defining the script method after you use it.

Try this


However, this a very crude method to get this behaviour. Do it on the server or use jquery.

With jquery:
I am trying to map a one to one relationship between a table and a view. However, the view doesn't contain the primary ID of the table, just another field that is unique. The view is legacy that does some calculations based on some tables (ugh!).

Anyways, what we have is something like this (extremely simplified):


These need to be joined across the invoice_id column, but it is not declared as an identifier in Order.

We have the following hibernate mapping file(s):

When I try to retrieve it, it tries to join across the Order.id field (OrderInvoice.invoiceId = Order.id). Can it be setup to use invoiceId without adding invoiceId to a composite key in the Order mapping?

Thanks!

Thanks for the help, here is what finally worked...

9 years ago

Tim Holloway wrote:Am I missing something here? Without the countdown it shouldn't be hanging indefinitely, it should be looping forever.



yea, I don't want it to loop forever. Just can't figure out why the -a {condition} is not working properly.
9 years ago
Want to monitor tomcat shutdown with the following script. However, it is returning '[: too many arguments]'. It works without the '-a $cnt -gt 0' part, but I don't want it to hang indefinitely.

9 years ago