[JBoss Messaging] - Development environment
by esfahan
Hi there,
I was just wondering how you guys out there are developing with Seam? Are there any tricks or special tools/plugins you are using?
I am using eclipse for coding, but the build is driven via maven2. This means that in order to see a simple change in say an xhtml page I have to rebuild the whole ear file and redeploy it (via cargo start/stop). That's takes a fair bit of time and is far from optimal.
I am trying for days to have some sort of war:inplace working within in webapp subproject. So far without success. My idea was to build and deploy the ear as normal (via cargo), but at the same time deploy the webapp also standalone in a separate tomcat instance running on a different port. For this to (possibly) work I am adding additional classes (via cargo) to the standard webapp classpath. It looks something like this:
| <plugin>
| <groupId>org.codehaus.cargo</groupId>
| <artifactId>cargo-maven2-plugin</artifactId>
| <configuration>
| <wait>true</wait>
| <container>
| <containerId>tomcat5x</containerId>
| <zipUrlInstaller>
| <url>
| http://www.apache.org/dist/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5....
| </url>
| <installDir>
| ${tomcat.install}
| </installDir>
| </zipUrlInstaller>
| <output>
| ${project.build.directory}/tomcat.log
| </output>
| <log>
| ${project.build.directory}/cargo-startup.log
| </log>
| <dependencies>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>
| jboss-ejb3-client
| </artifactId>
| </dependency>
| <dependency>
| <groupId>
| javax.persistence
| </groupId>
| <artifactId>ejb</artifactId>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>
| javassist
| </artifactId>
| </dependency>
| <dependency>
| <groupId>concurrent</groupId>
| <artifactId>
| concurrent
| </artifactId>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>
| jboss-ejb3-all
| </artifactId>
| </dependency>
| <dependency>
| <groupId>jboss-seam</groupId>
| <artifactId>
| hibernate-all
| </artifactId>
| </dependency>
| </dependencies>
| </container>
| <configuration>
| <home>
| ${project.build.directory}/tomcat5x
| </home>
| <properties>
| <!--<cargo.jvmargs>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8888,server=n,suspend=n -Xms128m -Xmx512m</cargo.jvmargs>-->
| <cargo.logging>high</cargo.logging>
| <cargo.servlet.port>
| 9090
| </cargo.servlet.port>
| </properties>
| <deployables>
| <deployable>
| <location>
| ${basedir}/src/main/webapp/
| </location>
| </deployable>
| </deployables>
| </configuration>
| </configuration>
| </plugin>
|
I also add the ejb jar itself to the lib directory of the webapp, because Seam has to be able to find the annotated 'named' entities at startup ( I think). Of course the actual beans are still deployed in the ear file. I also changed all interfaces to be remote. Uhh, pretty complicated I know. I am not even sure if this can work at all. Has anyone a comment to this approach? Basically Seam starts up and it makes calls to the ejbs deployed in JBoss. Some pages even work, but others just refuse to work.
Another apporach would be to use Tomcat only for development and deploy the webapp together with an embedded JBoss. Something along this: http://docs.jboss.org/ejb3/embedded/embedded.html.
Of course the whole war:inplace thing might be not worth the effort at all and there is a much better way of doing things. Any ideas/comments?
Cheers
--Hardy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984307#3984307
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984307
19Â years, 6Â months
[JBoss Seam] - Cleanup when a conversation expires
by rlhr
Hello,
I have a conversation that goes through several steps. During one step, files can be uploaded.
When the user finished the flow, the @end methods is called, and an entity is persited into the database (with the info how to retrieve the uploaded files in the file system).
Now if the user doesn't finish the flow (conversation expires), the entity will obvioulsy not be persisted. However, the uploaded files are already on the server.
My question is simple: what would be the best way to do a cleanup?
I think that it should be done by the method with the method:
@Destroy @Remove
| public void destroy() {
| ...
| }
|
Now the thing is that this method is called whether the conversation ends properly or expires.
So one way would be to set a "ConversationConpleted" flag in the @end method.
Then in the destroy method, I'll know whether the cleanup must take place or not.
Is there any other way to do this? I mean is there any way to annotate a method that would be called in case of conversation expiration and not when the conversation ends properly (thus eliminating the need for a status flag).
Thanks
Richard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984306#3984306
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984306
19Â years, 6Â months
[EJB 3.0] - Mystery solved!
by monkeyden
Mystery solved!
The @Column annotations for the primary key fields don't go on the entity bean at all. They go on the methods in the @IdClass only, though it doesn't break if they are in both places.
I now know that Bill refrained from the @Column annotations for clarity of the example, but beware of this in the book. Code below. Hope this helps someone.
Entity
package com.company.project.entity;
|
| import java.util.Date;
|
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.Id;
| import javax.persistence.IdClass;
| import javax.persistence.Table;
|
| import org.jboss.seam.annotations.Name;
| @Entity
| @Name("streetWatchEntity")
| @Table(name = "DWL_STREET_WATCH_LIST")
| @IdClass(StreetWatchPK.class)
| public class StreetWatchEntity implements java.io.Serializable {
| private static final long serialVersionUID = 4855048029589330487L;
|
| /**
| * PRIMARY KEY FIELD
| * Retrieves the UserKey from the entity
| */
| @Id
| public Long getUserKey() {
| return this.userKey;
| }
|
| /**
| * Sets the UserKey of the entity
| */
| public void setUserKey(Long userKey) {
| this.userKey = userKey;
| }
|
| /**
| * PRIMARY KEY FIELD
| * Retrieves the LocationId from the entity
| */
| @Id
| public Long getLocationId() {
| return this.locationId;
| }
|
| /**
| * Sets the LocationId of the entity
| */
| public void setLocationId(Long locationId) {
| this.locationId = locationId;
| }
|
| /**
| * PRIMARY KEY FIELD
| * Retrieves the AreaId from the entity
| */
| @Id
| public Integer getAreaId() {
| return this.areaId;
| }
|
| /**
| * Sets the AreaId of the entity
| */
| public void setAreaId(Integer areaId) {
| this.areaId = areaId;
| }
|
| /**
| * PRIMARY KEY FIELD
| * Retrieves the AddressStandardized from the entity
| */
| @Id
| public String getAddressStandardized() {
| return this.addressStandardized;
| }
|
| /**
| * Sets the AddressStandardized of the entity
| */
| public void setAddressStandardized(String addressStandardized) {
| this.addressStandardized = addressStandardized;
| }
|
| /**
| * Retrieves the Address from the entity
| */
| @Column(name = "ADDRESS", length = 128, nullable = true)
| public String getAddress() {
| return this.address;
| }
|
| /**
| * Sets the Address of the entity
| */
| public void setAddress(String address) {
| this.address = address;
| }
|
| /**
| * Retrieves the LastUpdate from the entity
| */
| @Column(name = "LAST_UPDATE", length = 7, nullable = true)
| public Date getLastUpdateDate() {
| return this.lastUpdateDate;
| }
|
| /**
| * Sets the LastUpdate of the entity
| */
| public void setLastUpdateDate(Date lastUpdate) {
| this.lastUpdateDate = lastUpdate;
| }
|
| /**
| * Retrieves the SeqNumber from the entity
| */
| @Column(name = "SEQ_NUMBER", length = 22, nullable = false)
| public Long getSeqNumber() {
| return this.seqNumber;
| }
|
| /**
| * Sets the SeqNumber of the entity
| */
| public void setSeqNumber(Long seqNumber) {
| this.seqNumber = seqNumber;
| }
| private String address = null;
| private String addressStandardized = null;
| private Integer areaId = null;
| private Date lastUpdateDate = null;
| private Long locationId = null;
| private Long seqNumber = null;
| private Long userKey = null;
| }
IdClass
package com.company.project.entity;
|
| import java.io.Serializable;
|
| import javax.persistence.Column;
|
| public class StreetWatchPK implements Serializable{
| private static final long serialVersionUID = 3355389391459690610L;
|
| private String addressStandardized = null;
|
| private Integer areaId = null;
|
| private Long locationId = null;
|
| private Long userKey = null;
|
| /**
| * No-arg constructor
| */
| public StreetWatchPK() {}
|
| public StreetWatchPK(Long userKey, Long locationId, String addressStandardized, Integer areaId) {
| this.userKey = userKey;
| this.locationId = locationId;
| this.addressStandardized = addressStandardized;
| this.areaId = areaId;
| }
|
| @Override
| public boolean equals(Object obj) {
| if (obj == this)
| return true;
| if (!(obj instanceof StreetWatchPK))
| return false;
| StreetWatchPK pk = (StreetWatchPK) obj;
|
| //User Key
| if(locationId.longValue() != pk.getLocationId().longValue()){
| return false;
| }
| //Location Id
| if(userKey.longValue() != pk.getUserKey().longValue()){
| return false;
| }
| //Area Id
| if(areaId.intValue() != pk.getAreaId().intValue()){
| return false;
| }
| if (!addressStandardized.equals(pk.getAddressStandardized())){
| return false;
| }
| return true;
| }
|
| @Override
| public int hashCode() {
| return addressStandardized.hashCode() +
| (int)areaId.intValue() +
| (int)locationId.longValue() +
| (int)userKey.longValue();
| }
|
| /**
| * @return the addressStandardized
| */
| @Column(name = "ADDRESS_STANDARDIZED", length = 128, nullable = false)
| public String getAddressStandardized() {
| return addressStandardized;
| }
|
| /**
| * @param addressStandardized the addressStandardized to set
| */
| public void setAddressStandardized(String addressStandardized) {
| this.addressStandardized = addressStandardized;
| }
|
| /**
| * @return the areaId
| */
| @Column(name = "AREA_ID", length = 22, nullable = false)
| public Integer getAreaId() {
| return areaId;
| }
|
| /**
| * @param areaId the areaId to set
| */
| public void setAreaId(Integer areaId) {
| this.areaId = areaId;
| }
|
| /**
| * @return the locationId
| */
| @Column(name = "LOCATION_ID", length = 22, nullable = false)
| public Long getLocationId() {
| return locationId;
| }
|
| /**
| * @param locationId the locationId to set
| */
| public void setLocationId(Long locationId) {
| this.locationId = locationId;
| }
|
| /**
| * @return the userKey
| */
| @Column(name = "USER_KEY", length = 22, nullable = false)
| public Long getUserKey() {
| return userKey;
| }
|
| /**
| * @param userKey the userKey to set
| */
| public void setUserKey(Long userKey) {
| this.userKey = userKey;
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984303#3984303
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984303
19Â years, 6Â months
[JBoss Seam] - Re: EntityManger-per-user-session...
by bkyrlach
See, this still leaves some key questions unanswered.
1) I've updated my ChildActions thusly...
| @In @Out
| Parent parent;
|
| @Begin
| public String preCreateChild()
| {
| parent = parentActions.getParent(parent.getId());
| return "/pc/createChild.xhtml";
| }
|
| @End
| public String createChild()
| {
| child.setParent(parent);
| parent.getChildren().add(child);
| return "/pc/viewer.xhtml";
| }
|
Which _mostly_ works the way I want. The one problem being that this method of adding the children to the parent doesn't take into account annotations on the children collection on parent which has (now) an @OrderBy("name"). By doing the following...
| em.persist(child);
| em.flush();
| em.refresh(user);
|
I can get around this, but that doesn't seem like it's the right way.
2) For my pre/edit action methods...
| @Begin
| public String preEditChild(Child child)
| {
| parent = parentActions.getParent(parent.getId());
| this.child = child;
| return "/pc/editChild.xhtml";
| }
|
| @End
| public String editChild()
| {
| return "/pc/viewer.xhtml";
| }
|
almost works, but again, I find that I have to change the line...
| this.child = child;
|
to this...
| this.child = em.merge(child);
|
Which also seems bad. I'm guessing I can add a helper method on ChildListBean similar to the method on UserActions that does a find on Activity, but again... all of this magically works when I use a session scoped EM because it doesn't forget these entities so quickly. I guess if it needs be done, then fine. It just seems a little ugly.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984302#3984302
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984302
19Â years, 6Â months
[JBoss jBPM] - Re: New jBPM Getting Started Documentation
by kbarfield
"EugeneV" wrote : Hi guys,
|
| I just finished reading the user guide and I absolutely love jBPM and think it's great. The guide itself is excellent and very helpful, too. It seems, though, that it was not written by a native English speaker. I am not one either, but I was really tempted to correct all grammatical errors and send it back to you - perhaps it is easier for someone like me to spot them and figure out what was meant to be said. However, before I spend a few hours of my time on it, I just want to make sure that there isn't a later version in the works. Please PM me since I am not watching this forum regularly [yet].
Ouch! And I thunk my english good!
On a more serious note, please feel free to correct any mistakes you see in the guide (it is a wiki open for anyone to edit). Several folks have made changes to the guide already. I am planning to create a new guide for the 3.2 release, but not planning any changes for the current guide.
Kevin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984301#3984301
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984301
19Â years, 6Â months