[JBoss Seam] - Using stateless beans generated by seam in standalone Java a
by JbossDing
I am pretty new to seam framework but have 3 years experience with previous versions of EJB. Our project is using seam to generate codes for a web application to access backend database. It works pretty good. However, I have the need to access the same database in standalone Java applications outside of Jboss virtual machine. When I looked at the seam-generated code, I am lost and need help.
First how to look up session bean in my Java application? I can not find the ejb-jar.xml so I do not know what is the jndi name used for the generated beans. Second, I do not know how to call those generated beans. For example, I have a table called Host in a test database, the table is simple with id, hostname, and connect_time. Use seam setup, seam new-project, seam generate-entities, and seam explode, seam framework did almost everything for me. It generates two java files in the action folder. Here is the code: in HostList.java
@Name("hostList")
| public class HostList extends EntityQuery {
|
| private static final String[] RESTRICTIONS = {"lower(host.hostname) like concat(lower(#{hostList.host.hostname}),'%')",};
|
| private Host host = new Host();
|
| @Override
| public String getEjbql() {
| return "select host from Host host";
| }
|
| @Override
| public Integer getMaxResults() {
| return 25;
| }
|
| public Host getHost() {
| return host;
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(RESTRICTIONS);
| }
|
| }
in HostHome.java
@Name("hostHome")
| public class HostHome extends EntityHome<Host> {
|
| public void setHostId(Integer id) {
| setId(id);
| }
|
| public Integer getHostId() {
| return (Integer) getId();
| }
|
| @Override
| protected Host createInstance() {
| Host host = new Host();
| return host;
| }
|
| public void wire() {
| }
|
| public boolean isWired() {
| return true;
| }
|
| public Host getDefinedInstance() {
| return isIdDefined() ? getInstance() : null;
| }
|
| }
By looking at the code, I am lost at how I should call the bean to make select, update, delete, and insert operations.
Would anyone give me some help or point me to some documents or tutorials? Thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063530#4063530
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063530
19Â years
[JBoss Seam] - flushMode= MANUAL, when does commit happen? And other questi
by enzhao
Hi,
I've read the latest reference section 8.3.3
http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/persistence.html#d0...
and annotated my long-running conversation with @begin(flushMode=MANUAL), wrote em.flush(); in the @End method. But I still have some questions. When does the transaction commit happen?
There are several nested conversation in the root conversation. A mother entity will be created at the beginning of the root conversation, persisted (in order to fetch the id) during the conversation. The nested conversations just add elements to the collections of the mother entity. I watched my shell output, during any nested conversation, each time when i say
| motherEntity.getChildren.add(sonEntity);
|
hibernate inserted a sonEntity to the database and commits (or not commited? ) How to make the persistence of the son entities happen at the end of the root conversation?
The hibernate.connection.autocommit is true by default, what's the consequence of setting it to false? I read the hibernate core reference, but did not get the answer.
And, I want the transaction of the root conversation to roll back (the persisted motherEntity should be removed) when the root conversation is time out. How to achieve this?
Any help would be highly appreciated!!
Regards,
Ellen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063523#4063523
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063523
19Â years
[JBoss jBPM] - Re: complex process definition
by ekrisjo
Thanks for the reply :-)
Let me elaborate a bit:
Lets say that after sending the message to the external system, a state is waiting for receipts. There are three possible transitions from that node: 'error', 'receipt' or 'expire'. 'receipt' is forked to some nodes and loops back to the wait state. 'error' are forked aswell, and looped back to the wait state. The loop is due to that I dont know how requests will be received from the external system at runtime (is this the correct way to do it?)
The 'expire' transition will go directly to the end-state.
Thinking about it, another question pops up in my head:
If one receipt comes in and go down the 'receipt' transition and during that execution a concurrent 'expire' request comes in to the wait state and put the processinstance in the end state. What will happen to the fork (or the token that is handled by the fork)?
thanks,
-Kristoffer
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063521#4063521
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063521
19Â years
[JBoss Portal] - HOWTO: Configure distinct portlet instances on a distinct pe
by mmartin123
I am having an architectural issue. Trying to discern the best way to go.
Currently I am storing a large graph-type object (a tree control) as a member variable of a portlet..
Example:
public class MyPortlet extends JBossPortlet{
private MyTreeControl treeCtrl = new MyTreeControl();
// Implementation / Interaction goes here...
}
Problem:
Want treeControl state to be unique for distinct users. In other words, the state of one user's tree control should not show up in anothers. So, user A expands node, user B should NOT be seeing his tree node expanded as well.. Currently, user B is seeing his tree node expanded whenver user A expands. I believe this is due to how JBoss Portal is managing portlet instances (ie. a single portlet instance is shared by all users of that portal application).
Solution Considerations:
1. I've considered putting the tree control into the Http Session object - but I've read that this is not the recommend approach for large data objects. Therefore I've held off that direction, as my tree can grow very,very large...
2. I'm currently looking into how to exploit the features of hibernate and/or JBoss Cache for purposes of storing this tree control on a per user basis (ie. one distinct instance for each distinct user).
Does the forum have any suggestions of what I might try?
Thank you in advance.
mmartin123
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063512#4063512
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063512
19Â years
[JBoss Seam] - Problem with JSF Expression Language
by thiagu.m
Hai every one i have problem with JSF Expression language, i describe about it.
i am working on registration page in seam, i need to allow the user to logged in after successfully register(i meant at the instance user register)
here i pass the registration page value to user bean and i call register method on my stateful session bean Register. here i need to assign the username, password value to Identity class in addition with user bean call
and i need to call Identity class login method.
with out the jsf Expression language i cant assign the value to Identity class, if i create Identity object manually i cant refer it by using expression language in my AuthenticatorAction class
Please any one give me the right solution
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063509#4063509
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063509
19Â years