[JBoss Seam] - Re: How to impliment a Paged + Sorted DataTable (session) wi
by antispart
I found something that works for me. I'm including it here in case it might help someone else (or perhaps someone could suggest a better solution):
| @Stateful
| @Name("testAction")
| @Scope(ScopeType.CONVERSATION)
| public class TestActionBean implements TestActionLocal {
| @Logger private Log log;
|
| @In(create=true)
| private EntityManager entityManagerSeam;
|
| private String searchString;
| private int pageSize = 10;
| private int page = 0;
| private int pageCount = 0;
| private String column = "testcolumn";
| private boolean ascending = true;
| private boolean refresh = false;
|
| public String find() {
| setRefresh(true);
| return null;
| }
|
| public String sort(String newcolumn) {
| if (column.equals(newcolumn))
| ascending = !ascending;
| column = newcolumn;
| return find();
| }
|
| public boolean isRefresh() {
| return refresh;
| }
|
| public void setRefresh(boolean refresh) {
| this.refresh = refresh;
| }
|
|
| public String firstPage() {
| page = 0;
| return find();
| }
|
| public String previousPage() {
| page--;
| return find();
| }
|
| public String nextPage() {
| page++;
| return find();
| }
|
| public String lastPage() {
| page = pageCount - 1;
| return find();
| }
|
| public int getPage() {
| return page;
| }
|
| public void setPage(int page) {
| this.page = page;
| }
|
| public int getPageCount() {
| return pageCount;
| }
|
| public void setPageCount(int pageCount) {
| this.pageCount = pageCount;
| }
|
| public int getPageSize() {
| return pageSize;
| }
|
| public void setPageSize(int pageSize) {
| this.pageSize = pageSize;
| }
|
| public boolean isAscending() {
| return ascending;
| }
|
| public String getColumn() {
| return column;
| }
|
| public String getSearchString() {
| return searchString;
| }
|
| public void setSearchString(String searchString) {
| this.searchString = searchString;
| }
|
| public List get() {
| ...
|
| return entityManagerSeam.createQuery("...")
| .setParameter("search", searchPattern)
| .setMaxResults(pageSize)
| .setFirstResult(page * pageSize)
| .getResultList();
| }
|
| @Name("testList")
| @Scope(ScopeType.PAGE)
| public class TestList implements java.io.Serializable {
| @Logger private Log log;
|
| @In(create=true)
| private FacesMessages facesMessages;
|
| @In(create=true)
| private TestActionLocal testAction;
|
| private List testList;
|
| private void refresh() {
| try {
| testList = (List) testAction.get();
| } catch (Exception e) {
| log.error("Exception", e);
| facesMessages.addFromResourceBundle("errors_List");
| }
| }
|
| @Unwrap
| public List create() {
| if (testList==null || testAction.isRefresh()) {
| testAction.setRefresh(false);
| refresh();
| }
| return testList;
| }
| }
|
With this setup ajax method invocations do not cause a new DB call (do not refresh the list) unless they're specifically meant to. The list is refreshed every time the page is accessed (but only once - by the testList==null test before hitting the db).
This works well for me and was the cleanest pattern I could find. Improvements very welcome though.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986901#3986901
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986901
19Â years, 7Â months
[EJB 3.0] - security-domain problem...
by kingkong1976
hi
by the way, i have forgot to mention, that the bean i would like to access anonymously is declared with @PermitAll.
in the mean time i have found out, that not the bean itself is the problem. the jndi lookup already try's to authenticate.
i have tried with this two initial context factorys
- org.jboss.security.jndi.JndiLoginInitialContextFactory
- org.jnp.interfaces.NamingContextFactory
but it is not working.
i have now a workaround implemented for the anonymous user:
1. i have set up an user account "anonymous" which belons to role "anonymous"
2. added the user anonymous to the enviroment for creating the initial context
3. created a special serviceloctar as non singelton, otherwise only the first request is succesfull...
that's it. not a really nice solution.
if anyone has a better solution, please let me know by sending an email -> thekingATbluemailDOTch (as the "Notify me when a reply is posted" is not really working :-( )
thanks daniel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986899#3986899
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986899
19Â years, 7Â months
[EJB/JBoss] - Re: WebLogic to JBoss conversion - EJB Client jar file?
by nsv
Hi
Need help urgently
below is the piece of code from config.xml from weblogic declaring jmsqueues ,topics and connectionfactories
Can you please tell me how can i declare the same in JBOSS
| <JMSConnectionFactory JNDIName="AlarmMgrConnectionFactory"
|
| Name="AlarmMgrConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory DefaultDeliveryMode="Non-Persistent"
|
| JNDIName="EventConnectionFactory" Name="EventConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory
|
| JNDIName="mydomain.JMSTestQueueConnectionFactory"
|
| Name="JMSTestQueueConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory
|
| JNDIName="mydomain.JMSTestTopicConnectionFactory"
|
| Name="JMSTestTopicConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory JNDIName="NotificationConnectionFactory"
|
| Name="NotificationConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory DefaultTimeToLive="15000" Name="TLIConnectionFactory"/>
|
| <JMSConnectionFactory DefaultDeliveryMode="Non-Persistent"
|
| DefaultTimeToLive="15000" JNDIName="TLIConnectionFactory"
|
| Name="TLINotifyConnectionFactory" Targets="myserver"/>
|
| <JMSConnectionFactory DefaultDeliveryMode="Non-Persistent"
|
| DefaultTimeToLive="15000" JNDIName="CacheConnectionFactory"
|
| Name="CacheConnectionFactory" Targets="myserver"/>
|
| <JMSFileStore Directory="." Name="TLJMSStore" SynchronousWritePolicy="Direct-Write"/>
|
| <JMSServer MessagesMaximum="10" Name="JMSServer-0"
|
| Store="TLJMSStore" Targets="myserver" TemporaryTemplate="MyJMSTemplate">
|
| <JMSQueue JNDIName="AlarmMgrRecvQueue" Name="AlarmMgrRecvQueue" StoreEnabled="default"/>
|
| <JMSQueue JNDIName="mydomain.JMSTestQueue1" Name="JMSTestQueue" StoreEnabled="default"/>
|
| <JMSQueue JNDIName="NotificationQueue" Name="NotificationQueue" StoreEnabled="default"/>
|
| <JMSQueue JNDIName="TLIRequestQueue" Name="TLIRequestQueue" StoreEnabled="default"/>
|
| <JMSQueue JNDIName="TLIResponseQueue" Name="TLIResponseQueue" StoreEnabled="default"/>
|
| <JMSTopic JNDIName="CacheSynchTopic" Name="CacheSynchTopic" StoreEnabled="default"/>
|
| <JMSTopic JNDIName="Event" Name="Event" StoreEnabled="default"/>
|
| <JMSTopic JNDIName="JMSTestTopic1" Name="JMSTestTopic" StoreEnabled="default"/>
|
| <JMSTopic JNDIName="TLINotifyTopic" Name="TLINotifyTopic" StoreEnabled="default"/>
|
| <JMSTopic JNDIName="TLObjectEvent" Name="TLObjectEvent" StoreEnabled="default"/>
|
| </JMSServer>
|
| <JMSTemplate Name="MyJMSTemplate"/>
|
i need this urgently as one of my internal application needs to be migrated from weblogic to jboss
Thanks
Vishnu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986897#3986897
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986897
19Â years, 7Â months
[EJB 3.0] - JBoss 4.0.3 SP1, MS SQL Server 2000, Persistence issue: java
by r.simoni
Hi at all.
I have an issue with JBoss 4.0.3 SP1 and MS SQL Server 2000 with SP3.
Accessing from a client a remote session bean (stateless), I'm able to lookup and call a test method that make persist an Entity Bean on a table.
But when the method finish execution, I receive an exception on JBoss saying:
java.net.SocketException: Connection reset
| at java.net.SocketInputStream.read(SocketInputStream.java:168)
| at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
| at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
| at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java
| :2196)
| at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Object
| InputStream.java:2376)
| at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStre
| am.java:2443)
| at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream
| .java:2515)
| at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputSt
| ream.java:2664)
| at java.io.ObjectInputStream.readByte(ObjectInputStream.java:875)
| at org.jboss.remoting.transport.socket.ServerSocketWrapper.checkConnecti
| on(ServerSocketWrapper.java:54)
| at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerTh
| read.java:217)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.j
| ava:298)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.jav
| a:169)
Other men have notified this problem saying that this is a simple logging problem, but in my application I'm unable to "save" Entity on DB. And this is the real problem. Persist method doesn't work.
I have tested the same application with JBoss 4.0.4.GA (changing libraries and stateless naming method) and I don't have any problem: Entity Bean are saved on DB without any exception.
Another problem is that I can't change to JBoss 4.0.4.GA :-(
Any idea?
Thanks to all
Bye
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986893#3986893
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986893
19Â years, 7Â months