[JBoss Seam] - i18n entity validation message?
by mosabua
Hi!
I need to find a way to internationalise the error message for a specific property on an entity bean. All the examples I found use static text like this
@NotNull
@Length(min = 2, message="Lastname has to be 2 characters of longer.")
public String getLastName()
{
return lastName;
}
I would like to internationalise these message (like the rest of the app) and would prefer to be able to keep the concern of the message within the entity. So I tried this
@In(create = true)
private transient ResourceBundle resourceBundle;
@NotNull
@Length(min = 2, message=resourceBundle.getString("person.lastName.length"))
public String getLastName()
{
return lastName;
}
but unfortunately the message has to be a constant expression so that does not work. Ideally something like this would work, where the message is automagically taken from the bundle.
@NotNull
@Length(min = 2, message=person.lastName.length))
public String getLastName()
{
return lastName;
}
Any pointers would be great. Also let me know if you think I should not have any of those messages linked to the entity directly even though the defaults will always kick in..
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965548#3965548
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965548
19 years, 9 months
[JBoss jBPM] - Re: jbpm.sar deployment from ant file lost when server is re
by brado
Ronald,
Thanks for the reply. Hey, what's the chances of getting jBPM releases up on ibiblio/maven2 with poms that hold all dependencies?
Also, here's another side question that's more about archive classloading than anything (working on multiple appservers, sometimes get wires crossed). I had a JAR library I developed, my custom SAR, and a webapp (WAR) I developed, all of which I put inside an EAR. All of the dependencies (JAR files) pulled in nicely to the EAR root, which alleviates the need to figure out each JAR to put into the server//lib directory. I gunned up JBoss, only to discover that even though all of my dependencies sat in the EAR root, the SAR and the WAR in my EAR were suffering ClassNotFoundExceptions, because they apparently these JARs in the EAR weren't on the classpath. Does this sound right? As I recall, an EAR was supposed to have its own ClassLoader and the contained SAR and WAR ClassLoaders were supposed to delegate to the EAR ClassLoader if a class could not be found. What am I missing?
Sorry -- I know these aren't jBPM questions per se, but they seemed analog to the thread.
Cheers,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965545#3965545
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965545
19 years, 9 months
[JBoss Eclipse IDE (users)] - Problem with classLoaders
by ivan_penuelas
a problem appears now there´s a fourum where explain it but a´m having the same problem, can you help me this is the error:
10:56:44,455 WARN [verifier] EJB spec violation:
Bean : Fibo
Section: 22.2
Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
Info : Class not found on 'tutorial.ejb.FiboBean': No ClassLoaders found for: tutorial.ejb.FiboBean
10:56:44,455 ERROR [MainDeployer] Could not create deployment: file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp35315FiboApp.ear-contents/FiboEJB.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:610)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@8dab2d02 { url=file:/C:/jboss-4.0.4.GA/server/default/deploy/FiboApp.ear }
deployer: org.jboss.deployment.EARDeployer@1afae45
status: Deployment FAILED reason: Verification of Enterprise Beans failed, see above for error messages.
state: FAILED
watch: file:/C:/jboss-4.0.4.GA/server/default/deploy/FiboApp.ear
altDD: null
lastDeployed: 1155743804299
lastModified: 1155743804205
mbeans:
my .jar file has:
META-INF/
META-INF/MANIFEST.MF
META-INF/ejb-jar.xml
META-INF/jboss.xml
META-INF/FiboBean.class
META-INF/Fibo.class
META-INF/FiboHome.class
and the war:
0 Wed Aug 16 10:56:04 CDT 2006 META-INF/
106 Wed Aug 16 10:56:02 CDT 2006 META-INF/MANIFEST.MF
0 Wed Aug 16 10:56:04 CDT 2006 WEB-INF/
3489 Wed Aug 16 09:41:06 CDT 2006 WEB-INF/web.xml
735 Wed Aug 16 09:41:06 CDT 2006 WEB-INF/jboss-web.xml
0 Wed Aug 16 10:56:04 CDT 2006 WEB-INF/classes/
3067 Wed Aug 16 10:22:14 CDT 2006 WEB-INF/classes/ComputeServlet.class
811 Wed Aug 16 09:43:34 CDT 2006 index.html
here its my ejb-jar.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ejb-jar (View Source for full doctype...)>
- <ejb-jar>
-
- <![CDATA[ No Description.
]]>
<display-name>Generated by XDoclet</display-name>
- <enterprise-beans>
- <!-- Session Beans
-->
-
-
- <![CDATA[ Description for Fibo
]]>
<display-name>Name for Fibo</display-name>
<ejb-name>Fibo</ejb-name>
tutorial.interfaces.FiboHome
tutorial.interfaces.Fibo
<ejb-class>tutorial.ejb.FiboBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
- <!-- To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the markup for those beans.
-->
- <!-- Entity Beans
-->
- <!-- To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the markup for those beans.
-->
- <!-- Message Driven Beans
-->
- <!-- To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
- <!-- Relationships
-->
- <!-- Assembly Descriptor
-->
- <!-- To specify your own assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
- <assembly-descriptor>
- <!-- To specify additional security-role elements, add a file in the merge
directory called ejb-security-roles.xml that contains them.
-->
- <!-- method permissions
-->
- <!-- To specify additional method-permission elements, add a file in the merge
directory called ejb-method-permissions.ent that contains them.
-->
- <!-- transactions
-->
- <!-- To specify additional container-transaction elements, add a file in the merge
directory called ejb-container-transactions.ent that contains them.
-->
- <!-- finder transactions
-->
- <!-- message destinations
-->
- <!-- To specify additional message-destination elements, add a file in the merge
directory called ejb-message-destinations.ent that contains them.
-->
- <!-- exclude list
-->
- <!-- To specify an exclude-list element, add a file in the merge directory
called ejb-exclude-list.xml that contains it.
-->
</assembly-descriptor>
</ejb-jar>
in the part tutorial.interfaces.FiboHome it has and everything but when i post it it doesn´t apeer
can someone helpme
best regards!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965543#3965543
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965543
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - Join Fetch returning cartesian product
by darrenclarke
Apologies in advance if I'm asking something dumb here; I'm sure there's an obvious answer to this but I've just spent a day with my EJB3 book and on Google and haven't been able to find it.
Imagine I have two entities - Parent and Child. Parent has a unidirectional one-to-many (lazy) relationship with Child, e.g:
@Entity
public class Parent {
@Id
private int id;
@OneToMany( cascade=CascadeType.ALL, fetch=FetchType.LAZY)
private List children = new ArrayList();
//snip
}
@Entity
public class Child {
@Id
private int id;
//snip
}
[Note : my List and ArrayList in Parent are typed as containing Child objects but the syntax isn't being displayed here as it thinks it's XML.]
Now imagine I have two Parents, each with three Child objects and I want a query to return all Parent objects including nested children:
SELECT p FROM Parent p LEFT JOIN FETCH p.children
I would expect this to return two Parent objects, but it returns six - each Parent object is repeated n times where n is the number of nested Child objects. If I use a "SELECT DISTINCT ..." then the problem is fixed, but that seems a strange thing to need to do and I'm wondering if it's necessary, or whether I'm missing something?
Thanks in advance,
Darren
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965538#3965538
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965538
19 years, 9 months
How to avoid useless SQL-Statement when setting CMR-Field in ejbPostCreate
by Sebastian Roth
Hi guys,
I hope someone can help me with that.
I use JBOSS 4.0.4GA.I have two Entities which have an 1:N RelationShip.
In my ejbPostCreate I set the CMR fields.
public void ejbPostCreate(Integer rank, LocalAdMaterial adMaterial,
LocalAdLoc adLoc, LocalAdActionType adActionType) throws CreateException
{
setAdMaterial(adMaterial);
setAdActionType(adActionType);
setAdLoc(adLoc);
}
In the SQL-Logs I recognized that before each set-method the container
does a select on the table to which the CMR-Field link to.
2006-08-16 17:21:45,081 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdMaterial]
Executing SQL: SELECT ID, NAME, STATUS, ISO_CODE, DESCRIPTION,
AD_FORMAT, AD_CAMPAIGN FROM AD_MATERIAL WHERE (ID=?)
2006-08-16 17:21:45,097 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdActionType]
Executing SQL: SELECT NAME FROM AD_ACTION_TYPE WHERE (ID=?)
2006-08-16 17:21:45,112 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.AdLoc] Executing
SQL: SELECT ID, ERLAUBT_TYP, AVG_TCP, AD_PARTNER, AD_CHANEL, AD_WEBSITE,
AD_FORMAT FROM AD_LOC WHERE (ID=?)
2006-08-16 17:21:45,128 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.AdActionTracking]
Executing SQL: UPDATE AD_ACTION_TRACKING SET AD_LOC=?, AD_MATERIAL=?,
AD_ACTION_TYPE=? WHERE ID=?
I do not know why these SELECT statements are executed. Is this a normal
behaviour?
Can please someone help me to avoid these useless SQLs.
Thanks and regards,
Sebastian
19 years, 9 months