[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1387) Support for overriding .cfg.xml properties in HibernateFactory (patch included)
by Przemyslaw Jaskierski (JIRA)
Support for overriding .cfg.xml properties in HibernateFactory (patch included)
--------------------------------------------------------------------------------
Key: JBSEAM-1387
URL: http://jira.jboss.com/jira/browse/JBSEAM-1387
Project: JBoss Seam
Issue Type: Feature Request
Environment: Microcontainer
Reporter: Przemyslaw Jaskierski
Fix For: 1.3.0.ALPHA
Attachments: HibernateFactory-patch.diff.zip
Currently HibernateFactory supports only one type of configuration at a time: .cfg.xml file or "programmatic" one passed by the cfgProperties property.
It would be great to have the ability to override individual properties from the specified .cfg.xml file using cfgProperties property. For example, when you want to have special value for hibernate.hbm2ddl.auto in case of tests only, and normal one in case of production environment.
Applying my patch makes the following thing possible (instead of maintaing two almost identicall hibernate.cfg.xml files):
<bean name="pecpHibernateSessionFactoryFactory" class="pecp.core.seam.HibernateFactory">
<property name="cfgResourceName">
<inject bean="pecpHibernateConfigurationLocation"/>
</property>
<property name="namingStrategy">
<inject bean="underscoreAwareNamingStrategy"/>
</property>
<property name="cfgProperties">
<map class="java.util.Hashtable" keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
<key>hibernate.hbm2ddl.auto</key>
<value>create-drop</value>
</entry>
</map>
</property>
</bean>
I've kept original logical code flow intact, so when there is no cfgResourceName and no cfgProperties set, Seam (as in original case) tries to call configuration.configure() and try to configure from hibernate.cfg.xml file. To make override functionality work you need to specify cfgResourceName property.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2430) JNDI lookup error when injecting a stateful bean into a stateful bean in glassfish
by Richard Hoffman (JIRA)
JNDI lookup error when injecting a stateful bean into a stateful bean in glassfish
----------------------------------------------------------------------------------
Key: JBSEAM-2430
URL: http://jira.jboss.com/jira/browse/JBSEAM-2430
Project: JBoss Seam
Issue Type: Bug
Reporter: Richard Hoffman
Per Pete's request (http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115521#4115521) I'm making a ticket about the problem I'm facing:
Using glassfish, I'm trying to inject a stateful bean into a stateful bean...instead of describing my specific app and trying to explain exactly what I'm doing and why, I figured I'd demonstrate how to duplicate my problem using the jee5/booking example provided with Seam 2:
1.) Add the following to the top of HotelSearchingAction:
import org.jboss.seam.annotations.In;
.
.
@In(create=true)
private HotelBooking hotelBooking;
2.) Redeploy and run the booking app.
3.) Navigate to the Search page. You should receive a "Could not instantiate Seam component: hotelBooking" error, which is caused by: "javax.naming.NameNotFoundException: No object bound to name java:comp/env/jboss-seam-jee5/HotelBookingAction/local"
Now, granted, in this particular case, there really isn't any functional reason to do this injection, but it demonstrates the same problem I'm having on my particular application (where this kind of injection makes sense). It is also worth noting that if you do the opposite injection (HotelSearching into HotelBookingAction), you have no problems.
One way I found to get around this problem is to put a @Startup at the top of the HotelBookingAction bean, but I'm not sure why this is necessary.
---
My theory as to what's going on is as follows...my apologies if I'm way off, heh:
The page flow of the booking app is Login -> Search (which uses HotelSearchingAction) -> Book Hotel (which uses HotelBookingAction). So, HotelSearchingAction gets (instantiated?) put in the JNDI tree first, as the user progresses through the app. The problem is, when you inject HotelBookingAction into HotelSearchingAction, HotelBookingAction needs to be created when HotelSearchingAction is first used, but it hasn't been put in the JNDI tree yet, so we get a lookup error. And of course, if you put @Startup on HotelBookingAction, HotelBookingAction is now in the JNDI tree way before HotelSearchingAction needs it, so the error is gone. But again, I'm not sure why @Startup should be necessary to inject a not-yet-used stateful bean into a stateful bean.
Thanks in advance to anyone who works on this ticket. :-)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1678) @Begin(flushMode=MANUAL) takes effect AFTER method call instead of before it.
by Frits Jalvingh (JIRA)
@Begin(flushMode=MANUAL) takes effect AFTER method call instead of before it.
-----------------------------------------------------------------------------
Key: JBSEAM-1678
URL: http://jira.jboss.com/jira/browse/JBSEAM-1678
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.BETA1
Environment: J2SE 1.5, Tomcat 6.0.10, Hibernate 3.2.3, HibEM 3.3.1
Reporter: Frits Jalvingh
(See also the end of thead at http://jboss.com/index.html?module=bb&op=viewtopic&p=4064502#4064502)
I have a method marked:
@Begin(flushMode=FlushModeType.MANUAL)
public String createNewTarget()
This method is meant as the start of a 2-screen conversation. This conversation should be rolled back if a user presses cancel so flushmode=MANUAL is used to prevent the persistence context from flushing db changes.
The method starts by creating a new entity and persist()s it. The problem is that this causes an immediate "insert" by Hibernate regardless of the flushmode.
I debugged the code and found that the flushmode gets set AFTER Seam calls the method, not before (ConversationInterceptor). This seems to be wrong, so I placed an extra call to set the mode in aroundInvoke():
setFlushMode(method); // JAL FlushMode should be set BEFORE we call the method!?
Object result = invocation.proceed();
beginConversationIfNecessary(method, result);
endConversationIfNecessary(method, result);
return result;
(flushMode in the original code is set in beginConversation()).
This at least fixes part of the problem; the other part of the problem is a bug in Hibernate where it always forces an insert even if it is not needed. I fixed that too which fixes the entire problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months