Oliver Chua

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

Recent posts by Oliver Chua

Hi,

In your log4j.properties, add this

so you can see the sql statements

I've tried recreating the problem but it worked fine for me.
Below are the log entries when creating the table and inserting a record

CREATE TABLE "Individual_Simple_Entity1"
(
"ID" NUMBER(19,0) NOT NULL ENABLE,
"BOOLEANFIELD" NUMBER(1,0) NOT NULL ENABLE,
PRIMARY KEY ("ID") ENABLE
)

insert into Individual_Simple_Entity1 (booleanField, id) values (?, ?)
binding 'true' to parameter: 1
binding '1' to parameter: 2

in the db, the value of booleanField becomes 1
Hi Jay,

Posting the Entity and the code that does the insert might help us with troubleshooting the issue.
Also, have you tried retrieving Entity1 using em.find(Entity1.class, id) to see if it can see the Entity1 instance?
Hi Kari,

To be able to decrypt the existing password, you can read the encrypted string from the database using JPA,
then decrypt it in the service layer.

The above solution will work although I have concerns about security.
The majority of applications/system consider it a security issue to send a customer's existing password by email.
What's stopping anyone from running this service to get customer's passwords?

Most would have a security question and answer filled up during registration.
When the customer forgets password, he supplies his username, security question/answer,
and a randomly generated password is emailed to him.
He will be forced to immediately change the password after he logins.
Hi,

I don't think there's an encryption/decryption support in JPA.
You would have to do the encryption in the business/service layer as opposed to domain/data layer.

What we usually do is use an api (SAAJ, etc) to encrypt password when they are inserted.
When retrieving, the password supplied is encrypted and compared to the encrypted string in the database,
and the user is allowed to login.
This means there is really no need for decryption.
It may be that the server is caching. Try restarting your server and redeploying.
It shouldn't give you that same error if you've already fixed the JPQL.

Sorry, I haven't used OpenJPA or WAS7 to be able to help you with your question.
Hi,


An error occurred while parsing the query filter 'SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = "KARAMCHEDU"'.
Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 93. Encountered: "\"" (34), after : ""

These two lines seem to suggest there's something wrong with the JPQL.
Shouldn't you be using single quotes instead of double quotes?
SELECT o FROM LocState o where o.deleted = false and o.country.id = 88 AND UPPER(o.name) = 'KARAMCHEDU'
Hi All,

I am using JPA on JSE.
I've added two records in the table, updated both records collectively,
and then retrieved both records to check they've been updated.

I've tried debugging, and the database is updated after the commit,
but the select doesn't return the newer versions.
If I get a new entity manager and use it to query, it passes.

Is there an explanation for this behavior
and is there a fix or a workaround without getting a new entity manager?

Thanks







Hi all,

I'm trying out two-phase commit using container managed transaction in Jboss and OracleXE.

It throws an exception when conn2 is retrieved.


Below are the files:

Stateless Bean


Bean interface


Test Class


persistence.xml


Datasource


Stack trace
Hi,

This seems to be a case of server caching.
It's now working.

Hi,

I'm following Mikalai Zaikin's SCBCD reviewer.
I'm trying to create an application-managed persistenace context in an EJB.

As far as I understood it, in EJB, for application-managed persistenace context,
the transaction-demarcation is still done by the container.
However, my test using Jboss is not being committed.

It stops at prePersist, and without any errors.
The test fails when it tries to retrieve the newly inserter

Could anybody give a clue why the transaction is not being committed?
Thanks!

Below are the files involved:

persistence.xml


Session Bean


Entity


Tester
hi guys,

good thing I registered early. =)

I finished uploading the rest to my blog...

http://www.jroller.com/page/oliverchua
20 years ago
When is the last day for the registration?
Can people sign up up to th day before the first day of the exams?

By the way, I attempted to create some simple reviewer
You can check out the first two topics at
http://www.jroller.com/page/oliverchua/?anchor=scja_reviewer_fundamental_object_oriented1

http://www.jroller.com/page/oliverchua

I'll be posting the rest tomorrow...
20 years ago
>I believe you can only have one form per page using jsf.
I'm posting a simplified version that recreates the problem...

This code tries to make 2 commandLinks, effectively creating 2 forms on the page. then it tries to insert the same 2 commandLinks inside a dataTable.

The behavior is as expected for the independent commandLinks. This would debunk the assertion that JSF1.1 does not support multiple forms in one page.

For the commandLinks inside the dataTable, the behavior is not the expected one. It does not forward to the next jsp.

Can anyone figure out why?

Page with form



Result Page


Faces-config

[ May 31, 2005: Message edited by: Oliver Chua ]
20 years ago
JSF
I am trying to incorporate Jsptags' Pager taglib in my JSF application
but I am stuck with this problem...

I'm using JSF1.1 RI...

The taglib has a pages tag, that sets up the clickable links to jump to certain pages.
When I click on the link, the associated action is not called.

The <previous> link works, but the <pages> links doesn't.
The only difference I can see is that the <pages> is called multiple times.

Initially, I had one form, but I kept getting the duplicate id error.
Since I cannot append to the id attribute to make it unique,
I decided to make each link a form...

I don't know if this is an issue but the <pages> param id is the same,
although they belong to different forms.
Can anyone verify if this is a bug or not?

Even if I leave out the id in the hope that the
compiler generate an id for each link, the same problem happens.

I attempted to append a number to the id attribute to make it unique,
like this id="pagesp#{pageNumber}", but it is not accepted by the compiler.

Anybody has an idea how to get this to work?

<CODE>
<pg :p rev>
<h:form>
<%request.setAttribute("pagerOffset", GeneralAction.extractOffset(pageUrl));%>

<h:commandLink id="prev" value="<<Previous"
action="#{groupingAction.search}">
<f :p aram id="prevp" name="pager.offset" value="#{pagerOffset}" />
</h:commandLink>
</h:form>
</pg :p rev>



<pg :p ages>
<h:form>
<c:set scope="request" var="pageNumber" value="${pageNumber}" />
<%request.setAttribute("pagerOffset", GeneralAction.extractOffset(pageUrl));%>

<h utputText value="#{pageNumber}"
rendered="#{pageNumber==currentPageNumber}" />

<h:commandLink id="pages" value="#{pageNumber}"
action="#{groupingAction.search}"
rendered="#{pageNumber!=currentPageNumber}">
<f :p aram id="pagesp" name="pager.offset" value="#{pagerOffset}" />
</h:commandLink>
</h:form>
</pg :p ages>

</CODE>
[ May 25, 2005: Message edited by: Oliver Chua ]
20 years ago
JSF