[JBoss Seam] - Re: ResourceBundle in Database
by Zerg-Spirit
Though it's a nice article and helped me simplify the whole stuff, it doesn't really speak about my mine problem: the caching issue.
Say, starting with your example, that I want to cache every locale's bundle, and reload them only if they have changed (tagged as 'dirty').
Then, how to 'stay' the Seam's ResourceBundle to reload? Cause even if I'm putting a @Observer(localeSelected) on the loadBundle method, the newly created ResourceBundle won't be used by Seam, who'll continue to use the previous one.
I think that's my main problem, and having the key to solve it would probably help me implement the solution (although I'm having the strange feeling the Component.getInstance("MyResourceBundle") is apparently referring to a different instance than my component.
Sorry for bothering, I hope I can fix all that eventually.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082608#4082608
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082608
18 years, 7 months
[EJB 3.0] - Issues with EJB 3.0/ JBoss 4.0.5
by avthosar
Hello,
I am using a 3rd party API called JBilling, which used EjB2.x and runs over Jboss 3.x, they have provided a Jar file to called JBilling API to access the JBilling Server, I have written a sample code to interact with same which includes the JBilling client jar, this code perfectly in standalone mode and in a servlets deployed on JBoss 4.0.5. But when the same code is called from within EJB 3 deployed on JBoss 4.0.5, i get the following exception.
java.lang.ClassCastException: org.jboss.remoting.InvokerLocator cannot be cast to org.jboss.remoting.InvokerLocator
Can anyone provide some pointers on how do i proceed from here? This is the first time I am seeing such an issue.
Thanks AVT
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082604#4082604
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082604
18 years, 7 months
[EJB/JBoss] - Re: Query over two tables causes 'Transaction is not active.
by pete.b.
Maybe some more snippets of my code should be beneficial.
The DB schema:
/* category */
| create table category
| (
| categoryID int not null primary key auto_increment,
| image varchar(50)
| ) type = innodb;
|
| /* categorytree */
| create table categorytree
| (
| parentID int not null,
| childID int not null
| ) type = innodb;
|
| /* categorydetails */
| create table categorydetails
| (
| categorydetailsID int not null primary key auto_increment,
| categoryID int not null,
| locale varchar(10),
| name varchar(50),
| description mediumtext
| ) type = innodb;
The appropriate entity beans:
@Entity
| @Name("category")
| @Table(name="category")
| @NamedQueries({@NamedQuery(name="find_all_categories",query="SELECT c FROM Category c"),
| @NamedQuery(name="find_all_categories_but_root",query="SELECT c, cd " +
| "FROM Category c, CategoryDetails cd " +
| "WHERE c.categoryID != 1 " +
| "AND c.categoryID = cd.category.categoryID " +
| "AND cd.locale = 'de' " +
| "ORDER BY cd.name"),
| @NamedQuery(name="find_category_root",query="SELECT c FROM Category c WHERE c.categoryID = 1")})
| public class Category
| implements Serializable
| {
| private static final long serialVersionUID = 4195849772297525701L;
|
| private Integer categoryID;
| private String image;
| private Collection<CategoryDetails> categoryDetails;
| private Category parent;
| private Collection<Category> children;
|
| public Category()
| {
| super();
| }
|
| /**
| * @return the categoryID
| */
| @Id
| @GeneratedValue(strategy=GenerationType.AUTO)
| public Integer getCategoryID()
| {
| return categoryID;
| }
|
| /**
| * @param categoryID the categoryID to set
| */
| public void setCategoryID(Integer categoryID)
| {
| this.categoryID = categoryID;
| }
|
| /**
| * @return the image
| */
| public String getImage()
| {
| return image;
| }
|
| /**
| * @param image the image to set
| */
| public void setImage(String image)
| {
| this.image = image;
| }
|
| /**
| * @return the categoryDetails
| */
| @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER,mappedBy="category")
| public Collection<CategoryDetails> getCategoryDetails()
| {
| return categoryDetails;
| }
|
| /**
| * @param categoryDetails the categoryDetails to set
| */
| public void setCategoryDetails(Collection<CategoryDetails> categoryDetails)
| {
| this.categoryDetails = categoryDetails;
| }
|
| /**
| * @return the parent
| */
| @ManyToOne
| @JoinTable(name="categorytree",
| joinColumns={@JoinColumn(name="childID")},
| inverseJoinColumns={@JoinColumn(name="parentID")})
| public Category getParent()
| {
| return parent;
| }
|
| /**
| * @param parent the parent to set
| */
| public void setParent(Category parent)
| {
| this.parent = parent;
| }
|
| /**
| * @return the children
| */
| @ManyToMany(cascade=CascadeType.ALL)
| @JoinTable(name="categorytree",
| joinColumns={@JoinColumn(name="parentID")},
| inverseJoinColumns={@JoinColumn(name="childID")})
| public Collection<Category> getChildren()
| {
| return children;
| }
|
| /**
| * @param children the children to set
| */
| public void setChildren(Collection<Category> children)
| {
| this.children = children;
| }
| }
|
|
|
| @Entity
| @Name("categorydetails")
| @Table(name="categorydetails")
| public class CategoryDetails
| implements Serializable
| {
| private static final long serialVersionUID = -8279365282184781250L;
|
| private Integer categoryDetailsID;
| private Category category;
| private String locale;
| private String name;
| private String description;
|
| public CategoryDetails()
| {
| super();
| }
|
| /**
| * @return the categoryDetailsID
| */
| @Id
| @GeneratedValue(strategy=GenerationType.AUTO)
| public Integer getCategoryDetailsID()
| {
| return categoryDetailsID;
| }
|
| /**
| * @param categoryDetailsID the categoryDetailsID to set
| */
| public void setCategoryDetailsID(Integer categoryDetailsID)
| {
| this.categoryDetailsID = categoryDetailsID;
| }
|
| /**
| * @return the category
| */
| @ManyToOne
| @JoinColumn(name="categoryID")
| public Category getCategory()
| {
| return category;
| }
|
| /**
| * @param category the category to set
| */
| public void setCategory(Category category)
| {
| this.category = category;
| }
|
| /**
| * @return the locale
| */
| public String getLocale()
| {
| return locale;
| }
|
| /**
| * @param locale the locale to set
| */
| public void setLocale(String locale)
| {
| this.locale = locale;
| }
|
| /**
| * @return the name
| */
| public String getName()
| {
| return name;
| }
|
| /**
| * @param name the name to set
| */
| public void setName(String name)
| {
| this.name = name;
| }
|
| /**
| * @return the description
| */
| public String getDescription()
| {
| return description;
| }
|
| /**
| * @param description the description to set
| */
| public void setDescription(String description)
| {
| this.description = description;
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082603#4082603
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082603
18 years, 7 months
[EJB/JBoss] - inserting value in mapped colom
by kaviarasu
hi im using thre tables table 1 which is a primary table which has two secondry tables table 2 and table 3
i want to insert the values to the secondry table table3 which colom is mapped to primary table using manyto one annotation
Table structure
Table1
1)Productid
2)ReviewId-primary key
table3
1)Commentid---primarykey
2)reviewid--mapped with primary table
3)comments
table2
1)userentryid------primarykey
2)2)reviewid--mapped with primary table
i want to insert value in table3 only where the commentid is autogenerated
and userid is get from the session
but i cant able to set review id because it is mapped as oblect
how to insert the value
the example code is
@Table(name="TBL_REVIEWS")
| public class TblReviews implements Serializable {
| @Id
| @GeneratedValue(generator="SeqID")
| @SequenceGenerator(name="SeqID",sequenceName="TBL_REVIEWS_SEQ",allocationSize=1)
| @Column(name="REVIEW_ENTRY_ID")
| private Long reviewEntryId;
|
| @OneToMany(mappedBy="reviewEntryId",fetch=FetchType.EAGER,cascade={CascadeType.ALL})
| private Set<TblComments> tblCommentsCollection;
|
|
| public Set<TblComments> getTblCommentsCollection() {
| return this.tblCommentsCollection;
| }
|
| public void setTblCommentsCollection(Set<TblComments> tblCommentsCollection) {
| this.tblCommentsCollection = tblCommentsCollection;
| }
| //other getters and setters
@Table(name="TBL_COMMENTS")
| @Name("tblcomm")
| public class TblComments implements Serializable {
| @Id
| @GeneratedValue(generator="SeqID")
| @SequenceGenerator(name="SeqID",sequenceName="TBL_COMMENTS_SEQ",allocationSize=1)
| @Column(name="COMMENTS_ID")
| private Long commentsId;
|
| private String comments;
| @ManyToOne
| @JoinColumn(name="REVIEW_ENTRY_ID")
| private TblReviews reviewEntryId;
| //other getters and setters
|
| public TblReviews getReviewEntryId() {
| return this.reviewEntryId;
| }
|
| public void setReviewEntryId(TblReviews wEntrreviewEntryIdyId) {
| this.reviewEntryId = wEntrreviewEntryIdyId;
| }
when i try the code like this
@In(required=false)
| TblReviews tr=new TblReviews();
|
| @In(required=false)
| TblComments tblcomm;
| @Out(required=false)
| @RequestParameter
| Long rid4comm; (review entry id value)
|
| public void writeComment() {
| tblcomm.setReviewEntryId(tr);
| em.persist(tblcomm);
| }
it inserting the other values except reviewentryid in secondry table
how to achive it
thank u regards
kaviarasu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082602#4082602
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082602
18 years, 7 months