Win a copy of Terraform in Action this week in the Cloud forum!

Tony Ennis

Ranch Hand
+ Follow
since May 22, 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 Tony Ennis

I have divs styled to be a certain width.



The contents of the divs are filled by a program. Sometimes these divs have no content. IE7 displays
them as I want - an 'empty' section of space of the specified width. IE8 and FF ignore the width, however,
and render the divs as 0px wide.

What do I do to force the empty divs to be displayed at the specified width?

If I put an   in the empty divs, they are rendered the way I want, but this is hokey.


I fetch a master row X from a database. This row has many detail rows.

Due to user input from a web page, a value in X becomes invalid due to a not-null constraint.

I loop over the details, performing processing on each one.

One of the detail rows executes a Hibernate 'select' query that has nothing to do with the error in X. I get this exception:

javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.mycompany.missioncriticalevaluation.model.X.endTime



Now, endTime is indeed broken. That's not wrong.

I don't understand why this exception is being thrown. I have not persisted, saved, flushed, etc any rows at all. The rows being returned by said query do not refer to X at all.

I'm stumped. Any ideas?
I have a detached hibernate model instance. It's brand new and has never been persisted. One of the attributes is null. When I attempt to merge() the row, I get a "not-null property references a null or transient value" exception. That's a correct error message.

(this is a web app, the user has to fix and re-submit the data)

But I can't fix the null attribute until I merge() it - and if I don't merge(), I get 'lazy load' exceptions.

Is there a merge()-lite that works for unpersisted rows?

(This is a highly sanitized description of course. There are many technical issues and many other technical approaches.)



Would 'translation time' be when the jsp was read from disk?

What if I wrote a new jsp and then 'forwarded' to this jsp? Will I die a crufty death? This is a relatively low volume app.

The custom tag also causes some crapola to be inserted towards the bottom of the jsp - even more stuff I'll have to generate manually if I decide to do the tag-to-html translation by hand.
11 years ago
JSP
I have a project where I generate form contents from a database table. Think survey questions with configurable controls.

This was working fine until one of my controls had to be a 'calendar box' that uses a custom tag. So on the server side, from a configuration, I generate this:



In my jsp I have this:



which squirts all the controls I generate into the jsp. Fine. My problem is that the calendar tag doesn't get interpreted - whatever re-interprets the custom tags into HTML isn't happening to the controls inserted by requestScope.contents.

Is there any fu to allow the custom tag interpretation to happen a 2nd time, at the end, etc??
11 years ago
JSP
I have some ant attributes related to hibernate tasks that "is not allowed here."



In that snippet, the ejb3, jdk5, filepattern, and templatepath attributes are flagged in my IDE as not allowed.

It all seems to work, but I'd really like to remove the warnings.

Any ideas on which jar I'm missing?
In the docs we see



I'm using JMS queues. Assuming I have my queue wired to inChannel, does this mean that every single time a message is written to inChannel, ExampleServiceActivator.foo() will be called?

What if two messages are written to inChannel at the same time (or close enough. You know what I mean ) ? Will it kick off one thread per message and potentially process them concurrently? Or will the ExampleServiceActivator be invoked serially, once for each message?

I'm having an issue that I originally thought was a JMS issue, but now I think it's some manner of ServiceActivator issue, or an XA transaction issue.

Namely, I'm putting 5 messages into a queue but my service activator is only being invoked twice. As I look at the queue using Gems I can see the other messages are there... But they'll never be processed.

Any ideas?

11 years ago
When starting an application that uses Hibernate I'm getting the following error:



I don't understand what configuration is making it want to update my schema. I don't want it to.

I removed this line from my persistence.xml file:



but it had no effect.

Any ideas?
To be honest, I don't know enough about Spring to answer your questions. I'm pretty sure we're using fairly default behavior. We're not doing anything fancy with Hibernate.

All I have to do is assure one group of work is committed before the other begins. If I were writing a servlet I'd simply issue a commit before I sent the messages via JMS.

You've given me words to search on, and that should get me farther along.

Thank you very much!
11 years ago
Paul,

A better locking strategy would help.

Practically speaking, I have two independent threads (?) that are trying to update the same row. The first thread finds a bunch of database rows, marks them "sent" and sends them via JMS to the 2nd thread (ultimately.) The 2nd thread receives these messages and marks the associated rows as "acknowledged."

If the first thread could change the rows' status and commit before sending, that would do the trick.

Or if the transaction was "autocommit" that would work too. I normally avoid autocommit but it's looking pretty good right about now.

Perhaps this is really a Hibernate question? Looking at your credentials I think I'm covered, however!

Here is my entity manager config:



11 years ago
I have a @scheduled method. When it runs, it scoops up some rows with a status of "A" from the database, sets their statuses to "B" so they won't get selected again, and sends the associated objects to their fate via JMS.

That's all working fine.

As part of a test, I added a sort of reflector service activator that returns an acknowledgment. That works fine.

And I made another JMS service activator that sees the acknowledgment and sets the associated rows' statuses to "C".

So the status should change from A if unsent, to B when sent, and to C when acknowledged.

Here's my difficulty - Sometimes messages will be acknowledged before the scheduled method completes. This causes a race condition. That is, the status of the row is "B" in the scheduled method and "C" in the service activator that records the acknowledgment. If the service activator finishes first, the C will be committed. When the main completes, the "B" will be committed over the top of the "C".

How can I get a commit into the scheduled service? If I can do this, I can select my rows, update their statuses, commit, then send the associated classes onward. The generated DAOs don't include a commit statement, I assume with good reason.
11 years ago
Flying on intuition, I added this method:

public void handleMessageResponse(String x) {}

And lo and behold, the message is delivered, as XML, in the x argument.

So now I just need to trawl a bit more and find a queue wrapped up in an 'unmarshalling' transformer of some sort, and pull my messages from there...

Yeah, I'm talking to myself. Seems to help.

I have discovered that the 'handleMessageResponse' method is being called, but with no arguments.

That is, instead of the following being called:

public void handleMessageResponse(TryMe tryMe) { ... }

this is being called:

public void handleMessageResponse() { ... }

Now I can't quite see how this is useful, but perhaps it's a step forward.
I have a program that uses spring and jms to load messages into a queue. Now I'd like to read them from that queue using a service activator. Try as I might, I'm having no luck at all. The symptom is that the service class doesn't see the queue/or is looking at the wrong queue. I know the service's constructor is being invoked but thereafter... nothing.



I removed all the annotations from WeakSauceService as they didn't seem to do anything.

I am using a tool to look at the queue so I know my messages are getting there. Whatever should invoke the handleMessageResponse method isn't happening.

If anyone has an example, that would be most appreciated.