[JBoss-user] [EJB 3.0] - Re: Lazy collection load

2006-06-11 Thread sierras
Obviouly is not the way because it does'nt work. I get an Exception

org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: entities.Country.organizations, no session or session was 
closed
at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at 
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at org.hibernate.collection.PersistentBag.size(PersistentBag.java:222)
at beans.CountryBean.doRefreshWithOrganizations(CountryBean.java:142)



Any idea of what to do?

Thanks.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3950283#3950283

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3950283


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Lazy collection load

2006-06-10 Thread sierras
In order to load a lazy collection of a detached entity I've a method in a 
session bean that does the work and returns the same instance of the object but 
with the collection loaded

public Country RefreshCountryCollection(Country country)
{
   em.merge(country);
   country.getChildrenOrganizations(); 
   return country;
}

Is this the rigth way of doing so??? Or there is a better way of doing so?

Thanks in advance!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3950255#3950255

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3950255


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - EntityManager problem

2006-05-24 Thread sierras
Hi:

I've two classes like this ones

@Stateless
public abstract class GeneralEntity
{

@PersistenceContext
public EntityManager em;

public String _EntityName;

protected void setEntityName(String str) 
{
_EntityName = str;
}
public String getEntityName() 
{
return _EntityName;
}

public int size() 
{
String strQuery = ;
try
{
Integer intTableSize;
strQuery = SELECT COUNT(record) FROM  + 
getEntityName() +  record;
Query query = em.createQuery(strQuery);
intTableSize = (Integer) query.getSingleResult();
return intTableSize;
}
catch (Exception e)
{
System.out.println(Query executada --  + strQuery);
e.printStackTrace();
}
return 0;
}

public List getAll() 
{
try
{
ArrayList list = new ArrayList();

String str = FROM   + getEntityName();

Query query = em.createQuery( str );

for ( Object o : query.getResultList() )
{
list.add(o);
}

return list;
}
catch ( Exception e )
{
e.printStackTrace();
}
return null;
}
}

public class CountryBean extends GeneralEntity implements CountryDAO
{   
/**
 * 
 */
private static final long serialVersionUID = 7872740458428627761L;

public CountryBean()
{
this.setEntityName(Country);
}
public Country getByUnitedNationsCode(String id) {
try
{
Country country;

//em is null here no matter what I do...

Query query = em.createQuery(FROM  + getEntityName() 
+  WHERE _CodiUnitedNations = ?1);
query.setParameter(1, id);
country = (Country) query.getSingleResult();
return country;
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
}

the problem is that when in a client I get the a remote interface and I call 
the method getAll() from the father class everything goes O.K. Just after that 
I make call to the getByUnitedNationsCode(...) method of the child class and 
then em (the variable injected with the entity manager) is null. 
Should'nt th derived class get the variable filled from the father class

Later on I tried to also put 
@PersistenceContext
public EntityManager em;

in the child class and it still does'nt work.


Any one has any idea why is not working .


Thanks in advance.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3946163#3946163

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3946163


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnkkid=107521bid=248729dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: EntityManager problem

2006-05-24 Thread sierras
I also anotate the child with @Stateless.

Only that I did'nt put in the text I should have done it!

I'll take a look at the link and see wht happends.

thanks anyway

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3946186#3946186

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3946186


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnkkid=107521bid=248729dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - ENTITY BEAN WITH SELF RELATIONSHIP

2006-05-16 Thread sierras
I've been looking around and around for some doc about how to make a Entity 
Bean with a one to many self relationship. (with a self foreign key).

I've found nothing.

EMPLOYEE with EMPLOYEE in a Manager OF relationship. Want to be able to 
locate both direction of the relationship.

Anyone can help me please?

thanks.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3944051#3944051

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3944051


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - WEB - EJB3 Application

2006-04-30 Thread sierras
Has anyone been able to connect a JSP page under Tomcat 5.5 to EJB3 server 
4.0.3 SP1.

I've been looking for it around I havent found anything about and it 
does'nt work. Or at least I don't know how to make it work.

Examples welcome!

Thanks in advance!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3940398#3940398

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3940398


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Tomcat, HTTPD, Servlets JSP] - WEB - EJB3 Application

2006-04-30 Thread sierras
Has anyone been able to connect a JSP page under Tomcat 5.5 to EJB3 server 
4.0.3 SP1.

I've been looking for it around I havent found anything about and it 
does'nt work. Or at least I don't know how to make it work.

Examples welcome!

Thanks in advance!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3940399#3940399

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3940399


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [JBoss Eclipse IDE (users)] - ECLIPSE IDE - @JoinTable problem

2006-04-28 Thread sierras
Writing an entity bean like this one

@Entity
public class .{

/* some properties */

/* CHILDREN */

private Set setInformationSystemUsers;

@ManyToMany
@JoinTable(name=nn)
public Set getUsers() 
{ 
return setInformationSystemUsers;
}

}

I get an editor error like The attribute name is undefined for the annotation 
type @JoinTable.

And trying to get editor's help (ctrl-space bar) I get a message like The 
annotation @JoinTable is disallowed for this location.

Does anyone know if this is a bug or that I simply don't know how to write EJB3 
entitites? And the sollution... please.

thanks in advance

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3940085#3940085

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3940085


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [JBoss Eclipse IDE (users)] - Re: ECLIPSE IDE - @JoinTable problem

2006-04-28 Thread sierras
Even though the documentations says another thing put...


@JoinTable( table = @Table(name = JOIN_ORG_ISU),
joinColumns = [EMAIL PROTECTED](name = Organization_ID_GEN)},
inverseJoinColumns = [EMAIL PROTECTED](name = 
InformationSystemUser_ID_GEN)} )


Maybe my documentation is not up todate.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3940139#3940139

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3940139


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Tomcat, HTTPD, Servlets JSP] - TOMCAT - EJB3 Application problem. URGENT HELP PLEASE!

2006-04-26 Thread sierras
This is the begining code of our web application in order to access to the EJB 
context

Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, 
org.jnp.interfaces.NamingContextFactory);
props.put(Context.URL_PKG_PREFIXES, org.jboss.naming:org.jnp.interfaces);
props.put(Context.PROVIDER_URL, jnp://localhost:1099);

Context ctx = new InitialContext(props);

if ( ctx != null )
{
System.out.println(We got a context.);
}
Object o = null;

o = ctx.lookup(cat.htmc.bussines.interfaces.CountryDAO);
if ( o instanceof CountryDAO )
{
O.K. if run as a java application code.
null if run under a jsp configuration under TOMCAT.
}


And excerb of the exception that we get is following

RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol:
Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/
2006-04-25 09:18:59,796 INFO [STDOUT] error unmarshalling arguments; nested 
exception is:
java.net.MalformedURLException: no protocol:
Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/
2006-04-25 09:18:59,796 INFO [STDOUT] no protocol:
Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/


Anyone can give any idea about what to look for

Thanks in advance. 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3939433#3939433

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3939433


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - WEB - EJB3 Application PROBLEM. URGENT HELP PLEASE!

2006-04-25 Thread sierras
This is the begining code of our web application in order to access to the EJB 
context

Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, 
org.jnp.interfaces.NamingContextFactory);
props.put(Context.URL_PKG_PREFIXES, org.jboss.naming:org.jnp.interfaces);
props.put(Context.PROVIDER_URL, jnp://localhost:1099);

Context ctx = new InitialContext(props);

if ( ctx != null )
{
System.out.println(We got a context.);
}
Object o = null;

o = ctx.lookup(cat.htmc.bussines.interfaces.CountryDAO);
if ( o instanceof CountryDAO )
{
   O.K. if run as a java application code.
   null if run under a jsp configuration under TOMCAT.
}


And excerb of the exception that we get is following

RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; 
nested exception is:
java.net.MalformedURLException: no protocol:

Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/
2006-04-25 09:18:59,796 INFO  [STDOUT] error unmarshalling arguments; nested 
exception is:
java.net.MalformedURLException: no protocol: 

Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/
2006-04-25 09:18:59,796 INFO  [STDOUT] no protocol: 

Files/JBOSS/jboss-4.0.3SP1/server/default/tmp/deploy/tmp17339EPSAWebSiteApplication-exp.war/WEB-INF/classes/


Anyone can give any idea about what to look for

Thanks in advance.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3939127#3939127

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3939127


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - PLEASE HELP - TOMCAT - EJB3 Integration problem

2006-04-21 Thread sierras
I've a project with a piece of JSP code running like this one


WorkerComment   

%
try
{
Country country;

ServerObjects so = ServerObjects.getSO();
CountryDAO countries =  so.getCountries();

if ( countries != null )
{
List list = countries.getAllCurrent();
Iterator iterator = list.iterator();

while ( iterator.hasNext() )
{
country = (Country) 
iterator.next();

%


%
}
}

The problem is that when running this code under a standalone Tomcat instace 
the code fails when calling so.getCountries(); which looks for the remote 
interface of a server object.

public CountryDAO getCountries()
{
Object o;
try
{
o = server.getConnection().lookup(COUNTRIES_OBJECT);
if ( o != null )
{
System.out.println(o);

if ( o instanceof CountryDAO )
{
return (CountryDAO) o;
}
}
}
catch ( Exception e )
{
e.printStackTrace();
}

return null;
}


The same code executed under a Java Application scenario works well. Gets the 
remote interface and everithing is OK.

When fails object o is not instanceof CountryDAO, then returns null.
When goes well  object o   is  (yes, yes) is  instanceof CountryDAO, then 
proxy object for the server object.

Is there anything between Tomcat and JBoss AS integration that I'm missing

The Application Server is the same. (JBoss AS 4.0.3 SP1).
The Library Class of the ServerObjects class is the same.
The Final code is the same.

Any idea about what's wrong

Thanks in advance.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3938704#3938704

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3938704


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Loading a database on @PostConstruct callback for SessionBea

2006-03-20 Thread sierras
I've a session bean wich on his @PostConstruct callback method tries to load 
the database on first time.

The problem is that i'm constantly getting an error of type EntityManager must 
be access within a transaction. I've tried to get a user transaction from
the injected session context but I'don't get it working.

this is the code I've

@PostConstruct
public void postConstructCallback()
{

System.out.println(LanguageBean. postConstructCallback(). 
Started.);

EntityManager manager;
Integer intTableSize;

//  EntityTransaction transaction = manager.getTransaction();
//UserTransaction transaction = context.getUserTransaction();

//manager = 
emf.createEntityManager(PersistenceContextType.EXTENDED);

try
{
//Query query = manager.createQuery(SELECT 
count(language) FROM Language language);
//intTableSize = (Integer) query.getSingleResult();

/*
if ( transaction != null  intTableSize == 0 )
{
transaction.begin();
this.loadDatabase(manager);
}
*/
System.out.println( 
YYY );
System.out.println( this.getAll().size() );
System.out.println( 
YYY );
}
catch (Exception e)
{
/*
try {
transaction.rollback();
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SystemException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
*/
System.out.println(LanguageBean. 
postConstructCallback(). Rollback due to errors.);
e.printStackTrace();
}
finally
{
}

System.out.println(LanguageBean. postConstructCallback(). Ended.);


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3931468#3931468

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3931468


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - SPECIAL CHARACTERS in a String. HELP! newbie question!

2006-03-14 Thread sierras
I've an EJB3 country bean.

One of the attributes is the country's name. And there are countries in the 
database that have special characters in their names, like  Cote d' Ivoire .

The problem is that when persisting this country to the database his name 
looses everything after the ' character.

Wich is the correct way of treating this problem? 

The solution is subtituting ' by '' (2 '). But...
because I think EntityManager gets the name from the corresponding method 
getName().

So... should I make on methos for EntityManager and another method for the 
application to get the string as it has to be visible in the form or is there 
another way to handle this??


Thanks in advance!!!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3930078#3930078

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3930078


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: java.sql.Timestamp mapping to Oracle database

2006-02-21 Thread sierras
 instead of  has solved the problem without doing anything else.

Thanks anyway.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3925281#3925281

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3925281


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: java.sql.Timestamp mapping to Oracle database

2006-02-21 Thread sierras
property name=hibernate.dialect value=org.hibernate.dialect.Oracle9Dialect  
instead of property name=hibernate.dialect 
value=org.hibernate.dialect.OracleDialect has solved the problem without 
doing anything else.

Thanks anyway.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3925282#3925282

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3925282


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - java.sql.Timestamp mapping to Oracle database

2006-02-10 Thread sierras
In an EJB 3.0 application...

How do I get an Entity with an attribute of type java.sql.Timestamp mapped into 
an Oracle database as Timestamp(9) instead of as a Date as I'm getting now.

Tanks in advance.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3922960#3922960

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3922960


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user