Lonnie Lewis

Greenhorn
+ Follow
since Mar 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Lonnie Lewis

Never mind, I got it to work. I needed to add "if not exists" in the creation of the elements. Not sure why, maybe the script is being executed more than once? I don't know...
13 years ago
Hello,
I'm attempting to configure an embedded HSQL database in a maven/hibernate project for unit testing. For "production mode", I have configured an Oracle database, with works fine (I can add, delete, etc.).

For unit testing, I first tried specifying in the spring config file:



schema.sql contains SQL for creating all of the tables and sequences. When running, I get errors saying the tables already exist. OK, I remove that line and have just:




When I run that, I get "user lacks privilege or object not found" when attempting to insert the data found in the "test-data.sql" file. I assume that the tables do exist (since I get the first error message) and I just don't have access. The information I've seen don't seem to imply security credentials are needed for the embedded databases, but I'm not sure about that. I attempted to change the configuration passing credentials like:



But I get the same "user lacks privilege or object not found".

If I remove the jdbc:initialize-database element completely, I get the same "user lacks privilege or object not found" error as the test case is attempting to create a JPA object.


Any idea what I'm doing wrong?

13 years ago

Bear Bibeault wrote:Did you check the JSP FAQ? The answer is there, waiting for you.



Again, thanks for the reply. Yes, I did look at the FAQ, if this is the one your are talking about: http://faq.javaranch.com/java/ResourceUrlProblems, along with others and they seem to point to the solution that I started out with.



(emphasis on ${request.contextPath})

It seems like my problem is because I'm accessing the application via the default (ROOT.xml). There looks like there was a similar problem here https://coderanch.com/t/414451/JSP/java/fail-include-file-from-upper#1827169

If you are referring to a different FAQ article, please let me know.

15 years ago

Bear Bibeault wrote:You are using page-relative addressing. Bad idea. Very bad. As you've discovered.

Use server-relative addressing (starts with context path). There's a JSP FAQ in this subject.



Thanks for the reply. I should have added a little more detail. I started out with:



Which is, I think, the correct way to use context paths. Is this right? If so, what else could be the problem?

When trying to fix the problem, I took out the context pathing stuff which didn't seem to have any affect on the problem.
15 years ago
I'm having a problem that I'm sure has been answered at least 100 times, but I just can't find the answer

I have deployed a web application and have configured the ROOT.xml file to use it as the default:



That all works fine, my application come up using either http://www.fubar.foo/myApp, or http://www.fubar.foo. The problem is if I access via http://www.fubar.foo, it doesn't find either my CSS or javascript files. Right now I'm including them like:



What am I doing wrong?

Thanks
Lonnie


15 years ago
I am populating a table (h:dataTable) with a Hibernate managed collection. The table is populated fine using:


When I make a change to the "make" in this example and submit the form, the "make" field is correctly updated for the appropriate object in the collection.

My problem is in updating the "carCondition" using the h:selectOneListbox. I can understand why it wouldn't work; changing the "id" field in the embedded "carCondition" object, when I would really want the database relationship changed.
How should this best be done? Am I missing an easy way to do this or in my "actionListener" method should I just read the form parameters, find the correct value (the selected "carCondition" id), find the correct CarCondition object and update the "car" object myself? Is there an easier way?
15 years ago
JSF
I'm having a strange foreign key problem. I'm allowing Hibernate to create my table structure based on my annotated classes. When using the following



The generated table includes:



I'm getting a foreign key: car_id -> person_car.id

I can't figure out why it is creating the creating a foreign key back to the PERSON_CAR table. If I provide the annotation:

There is more code in the application. What other annotations create foreign keys? What could I be doing wrong?

Thanks.




I am having a problem getting my page beans' "init", "preprocess" and "prerender" methods to fire. My page beans are inherited from "com.sun.jsfcl.app.AbstractPageBean" which do have these methods defined. From what I've found, it appears that my problem is a lack of a "phase-listener" in my faces-config.xml file. How should this be configured? If I put in:

<lifecycle>
<phase-listener>com.sun.jsfcl.app.AbstractPageBean</phase-listener>
</lifecycle>

I get an error that the phase listener can't be instantiated. How do I configure my application so that the "init", "preprocess" and "prerender" methods fire?

Thanks,
Lonnie
16 years ago
JSF