Karol Oslowski

Ranch Hand
+ Follow
since Jul 22, 2005
Merit badge: grant badges
For More
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 Karol Oslowski

Thanks a lot for this answer. I'm getting the context throught jndi lookup and all is working fine!

Cheers,

k.
16 years ago
Dear all,

I'm trying to write a custom validator as described here

The validator is intended for use with new users registering and he has to check whether the login given by user is still available. Therefore I need to connect with the data layer to execute a finder on users. Is there any simple way of doing that?

@PersistenceContext
private EntityManager em;

doesn't help since validator aint a bean.

Thanks in advance for any help,

Kind Regards,

karol
16 years ago
Hi,

Thanks a lot for your help. I solved the issue. What I had to do is to set the show_sql property in persistence.xml file of my project.

Regards,

k.
16 years ago
Dear Jaikiran,

Thank you for your fast answer. Unfortunatelly your solution didn't help. Where should I put the hibernate.properties or hibernate.cfg.xml files ? I tried to put them into lib dirs, WEB-INF/classes but it didn't help at all (I have impression that hibernate doesn't read those files).

Kind Regards,

k.
16 years ago
Dear all,

We have just moved our development to jboss 4.2.2. Everything works fine except that we are getting lots of logs from hibernate like:


01:44:20,976 INFO [STDOUT] Hibernate:
select
cataloguee0_.id as id24_,
cataloguee0_.name as name24_,
cataloguee0_.paren



I was trying to get rid of them by configuring log4j, looking in documentation and everywhere but I failed to find information how to hide those informations. I would be grateful for any advice.

Kind Regards,
k.
16 years ago
I found here

a description of solution for my problem:



Using an Enumerated Annotation

Programmers sometimes run into problems when they use an Enumerated annotation in combination with the Java Persistence Query Language.

An Enumerated annotation specifies that a persistent property or field should be persisted as an enumerated type. An enum (the base class for all enumerated types) can be mapped as either a string or an integer. There are two enumerated types: ORDINAL and STRING. If the enumerated type is not specified, the enumerated type is assumed to be ORDINAL.

Problems arise if you try to assign a numeric or string value based on an enum type. For example, in entity class Customer, CustomerStatus is an enum. The field status in Customer, defined as CustomerStatus, is mapped to an integer. You might think that the following Java Persistence Query Language query correctly queries customer status:
String ejbql = "SELECT c FROM Customer c
WHERE c.status = 1";

In fact, the query throws a java.lang.IllegalArgumentException. The exception is thrown because the Java Persistence Query Language compiler is expecting an enum constant.

The correct way to query the customer status is as follows:
// run a Java Persistence query
String ejbql = "SELECT c FROM Customer c
WHERE c.status = :status";
Query query = em.createQuery(ejbql);
query.setParameter(
"status", Customer.CustomerStatus.FULL_TIME);

In the correct query an enum constant, Customer.CustomerStatus.FULL_TIME is assigned to the enum field status.



I don't really like it, is it any way of putting an enum constant directly into a query?

Regards,
Dear All,

I'm developing an application in EJB3. I have an entity bean with stored column which value is of enum type. I was wondering how to write a select (@namedquery) where I want to find all fields with value equal to one of the enum values?

Kind Regards,

karol
Dear Jeanne,

Thank you very much for your answer. I know how to make database indexes manually, I just thought it may be somehow integrated in EJB so that during any database schema change (what happens relatively often on early stages of developmen) I wouldn't have to add the indexes manually. I suppose I'll have to write the indexes creation in a separate script.

Kind Regards,

k.
Hi Jeanne!

Thank you very much for your answer. As far as I remember in EJB 2.1 one could define database indexes in descriptor files. I'm not completely positive about that because maybe it was a vendor specific feature....

So you suggest that I should "manually" create indexes in my database?

Kind Regards,

Karol Oslowski
Dear All,

I was wondering how in EJB3 define database indexes on selected columns. Does any of you know how to do that ?

Thanks in advance for helping,

Kind Regards,

KArol Oslowski
Hello,
Approximately one year ago, together with my colleague, we had to make a decision what technology to use for the development in some project of ours. At the time, after quick investigation, we came up with the idea of using J2EE, that is EJB + JSF. Let alone the EJB but let me share with you some thoughts that I have about JSF after this year of work with it.
Below you will find a mixture of features (that I would expect any decent web framework to support) and problems (that I would expect any decent framework to solve and let developer not worry about it). Here we go:
-) use of browser back button,
-) page bookmarking,
-) double form submission (by double user click),
-) opening link in new browser tab/window,
-) having multiple copies of a page/service in different browser tabs/windows
Now, correct me if I'm wrong, but I think all of the above pose some (lots of?) difficulties in JSF. And I know that some of those are not easy issues (like browser's back button) but personally I think this list is way too long...
I don't really know any alternative web frameworks so I cannot compare but is it really that the developer has to deal with all of those issues on his own? Or are there frameworks where one does not need to worry about those irritating problems and can concentrate on real development... and JSF is just too immature to provide that?
Best wishes
17 years ago
JSF
Hi,

I need advice. I'm working on security and the standard resouce securying via web.xml and j_security_check doesn't fit my needs. I would like to achieve such goals:

- Change the standard scenario: when user tries to access secured area he is redirected to login page - and then after successful authentication - get's access to secured resources. I would like to be able to redirect him sometimes first to some other page - for instance page forcing him to change the password - and only then to the requested resource,
- be able to put the login-form on any page and after logging in redirecting back to that page,
- requesting re-authentication for specific resources (and protecting access to them via SSL
- etc.

I've developed my own LoginModule and it's working perfectly but the standard solution with j_security_check and tomcat doesn't seem to fit my needs.

My question is where should I look for any information about how to achieve my goals? I've looked to the Jboss administraiton guide but still I'm not sure what to do.

Will I have to change/add something to JBoss source code?

I would be very grateful for any advice.

With Kind Regards,

Karol Oslowski
17 years ago
Dear All,

for I while I am working on an old problem - I am trying to be enable users to log in from any page. I am using jboss 4.03 SP1 and myfaces/trinidad. I successfully developed a custom login module. When I was using "standard" JASS configuration everything was perfectly fine. When trying to find out how to allow users to log in from any page I found this
message explaining how to integrate SecurityFilter with jboss.

And again everything seemed to work fine. My login module methods are being called, the login method is being called with success... But, the method:



returns false. Actually I've checked it and everything (principal, and rolename) are set correctly simply there are no roles attached to the principal in the realm I get.

I don't put here more source code since it can be found under the first link but of course I can provide more.

Thanks in advance for any help,

Karol
17 years ago
Hi,

I am trying to achieve something equivalent to the code below in myfaces with ADF:



I tried to prepare a form with all input fields needed and then in the button action I tried two things. First I did something like this:



but then the arguments weren't passed

After that I tried something what worked for me earlier, that is:


unfortunatelly in this case it didn't work because I get an exception:


java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:313)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
at org.apache.myfaces.adfinternal.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:40)
at org.apache.myfaces.adfinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:208)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
at org.apache.myfaces.adfinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:175)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.adfinternal.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:320)
at org.apache.myfaces.adfinternal.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:289)
at org.apache.myfaces.adfinternal.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:213)
at org.apache.myfaces.adf.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:90)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)



When I use the same code to redirect to a webpage from my application it works...



I would be really grateful for any suggestions, I have an impression that it should be really easy...

Kind Regards,

Karol Oslowski
17 years ago
JSF
I found an answer to my question here
17 years ago
JSF