[JBoss Seam] - Re: Scriptaculous Sortable List Integration with Seam Remoti
by nathandennis
it took me a bit, but after i stopped trying to make theirs serialization work,, and used my head,,, i came up with a workaround.
what i was trying to do was get the graphically ordered list to the server so i could sort it in an array and persist any changes.
created session bean with a string field and use seam remote.
| Sortable.create('list',{onUpdate:function(){
| var orderLayerList = '';
| var orderedNodes = document.getElementById('list').getElementsByTagName('li');
| for (var i = 0; i < orderedNodes.length; i++) {
| orderLayerList += orderedNodes
| .getAttribute('id') + ', ';
| }
| Seam.Component.getInstance('someAction').parseLayerList(orderLayerList);
| var ef = new Effect.Highlight('list',{});}});
|
parse the string with a tokenizer.
| StringTokenizer line = new StringTokenizer(list,", ", false);
| int tokencount = line.countTokens();
| log.info("token count" + tokencount);
| List<String> layerarray = new ArrayList<String>();
| for (int dem=0; dem < tokencount ; dem++){
| layerarray.add(line.nextToken());
| log.info(layerarray.get(dem).toString());
| }
|
then i got distracted and i havent finished the rest. but now it is in an array and should be no problem.
was that a good approach? seemed to work.
thanks for the response though.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118489#4118489
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118489
18 years, 6 months
[JBoss Seam] - Re: Seam Interceptors
by Kragoth
Ok, I've made a bit of progress, and I have a working interceptor.
Code as follows:
The actual interceptor:
| package gekko.web.services;
|
| import org.jboss.seam.annotations.intercept.AroundInvoke;
| import org.jboss.seam.annotations.intercept.Interceptor;
| import org.jboss.seam.intercept.AbstractInterceptor;
| import org.jboss.seam.intercept.InvocationContext;
| import org.jboss.seam.log.LogProvider;
| import org.jboss.seam.log.Logging;
|
| @Interceptor
| public class GekkoSpringInjector extends AbstractInterceptor {
|
| private static final LogProvider log = Logging
| .getLogProvider(GekkoSpringInjector.class);
|
| @AroundInvoke
| public Object aroundInvoke(InvocationContext invocation) throws Exception {
| log.debug("********************************************");
| Object result = invocation.proceed();
| return result;
| }
|
| }
|
The annotation
| package gekko.web.services;
|
| import static java.lang.annotation.ElementType.TYPE;
| import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
| import java.lang.annotation.Retention;
| import java.lang.annotation.Target;
|
| import org.jboss.seam.annotations.intercept.Interceptors;
|
| @Target(TYPE)
| @Retention(RUNTIME)
| @Interceptors(GekkoSpringInjector.class)
| public @interface SeamAutowired {}
|
My only concern now is that every Seam bean will now have to have this annotation for the interceptor to fire. How can I make this a "default" interceptor? Just like the Bijection Interceptor. Cause as it stands I don't see any way of doing this as the Bijection Interceptor is hard coded as a default interceptor
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118478#4118478
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118478
18 years, 6 months
[EJB 3.0] - Re: Returning a class with OneToMany mappings causes infinit
by mjhammel
Ugh. It took quite a while to figure this out, mostly because I'm just an old C developer and not a Database/Java/WebServices/SOAP/JAX/BlahBlahBlah person. But after actually considering switching to Glassfish just to solve this last problem (but deciding it wasn't necessarily any easier to understand), I sat back down and thought through what I new was the problem.
Hibernate generates the EJB classes from my existing MySQL db. If any tables in the db have Foreign Keys defined, Hibernate will produce the set/get methods with the OneToMany annotations. These methods cannot be converted to XML (by whatever internal mechanisms are doing that) because they cause infinitely deep XML to be produced.
The way out of this trap is to drop the use of Foreign Keys in my database. As far as I can tell, the only drawback to this is that my own code will need to check to guarantee data integrity between the old foreign key and it's associated table field - in other words, I need to make sure the other table has an entry with the specified value before adding a new entry to the table that was originally configured with the foreign key reference.
So I pulled out the foreign keys from my test db and sure enough, I'm now able to pull a row from the db via the Web Services interface and return it to the remote client as a class object. This is exactly what my old EJB2.1/JBOSS 4.0.5GA/Middlegen based setup used to do. Now I can do it (sans foreign keys) with EJB3.0/JBOSS 4.2.2GA/Hibernate.
Whew. That was a painful month. Here's hopin' it gets easier from here on out.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118456#4118456
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118456
18 years, 6 months
[Persistence, JBoss/CMP, Hibernate, Database] - setMaxResults(100) NE set rowcount 100
by arnieOag
I have a database with 23,350,000+ records, 842,960 of which are for the city of Austin.
When I issue the following SQL through my IDE:
| set rowcount 100
| select * from state_card_holders where phys_adrs_city = 'AUSTIN'
|
The database responds in less than a second with the top 100 records.
When I run my Hibernate code:
| session = sessFac.openSession();
| searchCriteria = session.createCriteria(StateCardHolders.class)
| .add(Restrictions.eq(fieldName, fieldValue))
| .setMaxResults(100)
| addOrder(Order.asc("nameLast")).addOrder(Order.asc("nameFirst"))
| .list();
|
It takes 3 minutes. Clearly something is amiss and I suspect that the setMaxResults statement isn't resulting in a set rowcount 100 being issued by Hibernate, but rather its scanning the entire result set of 800+ records and discarding all but the first 100.
Which takes 3 minutes.
Is there not a way to make this more efficient? How do I tell Hibernate to tell Sybase to only return the top 100 records?
I could always revert back to using a Stored Procedure, but would rather not.
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118450#4118450
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118450
18 years, 6 months
[JNDI/Naming/Network] - JMS Provider failiure XAConnectionFactory
by rlopezpe
I'm getting this error in my server log and can't figure out what's causing it. I have a mySQL datasource setup which works fine and that's about it but keep getting this error in my log every 5 seconds or so. I've been searching trying to find a solution to this but all unsuccessful.
Here's a copy of mysql-ds.xml file:
<datasources>
| <local-tx-datasource>
| <jndi-name>MySqlDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/formbuilderdb</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>adobe</user-name>
| <password>mypwd</password>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <!-- sql to call when connection is created
| <new-connection-sql>some arbitrary sql</new-connection-sql>
| -->
| <!-- sql to call on an existing pooled connection when it is obtained from pool
| <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
| -->
|
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
This is my application policy code:
<application-policy name = "MySqlDbRealm">
| <authentication>
| <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
| <module-option name = "principal">adobe</module-option>
| <module-option name = "userName">adobe</module-option>
| <module-option name ="password">mypwd</module-option>
| <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
| </login-module>
| </authentication>
| </application-policy>
I've added the two lines in bold to the standardjbosscmp-jdbc.xml file right under de "defaults" tag:
| <datasource>java:/MySqlDS</datasource>
| <datasource-mapping>mySQL</datasource-mapping>
I am not very familiar with JBOSS but this sounds to me like it should be something simple, any help?
Error Log:
2008-01-09 15:51:50,093 INFO [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Trying to reconnect to JMS provider
| 2008-01-09 15:51:50,093 INFO [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Trying to reconnect to JMS provider
| 2008-01-09 15:51:50,093 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Reconnect failed: JMS provider failure detected:
| javax.naming.NameNotFoundException: XAConnectionFactory
| at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:223)
| at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:134)
| at sun.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:229)
| at $Proxy240.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:151)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245)
| at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:173)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:605)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1471)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-09 15:51:50,093 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Reconnect failed: JMS provider failure detected:
| javax.naming.NameNotFoundException: XAConnectionFactory
| at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:223)
| at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:134)
| at sun.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:229)
| at $Proxy240.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:151)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245)
| at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:173)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:605)
| at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1471)
| at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118436#4118436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118436
18 years, 6 months