Re: Encoding problem in geronimo-javamail implementation

2008-06-02 Thread maho77



Rick McGuire wrote:
> 
> maho77 wrote:
>> Hello,
>>
>> it seems to me that the geronimo javamail implementation has some
>> encoding
>> problems. I use G2.1.1
>> I retrieve Message via POP3 and than I start parsing the parts in the
>> Message class. Everything works fine as long as I the mails are UTF-8
>> mails.
>> If there's an mail lets say with ISO-8859-1 the subject has the correct
>> encoding conversion, but not the content of the parts.
>>
>> If I try the same with the javamail implementation from sun, it works
>> well.
>>
>> Do I have to set some properties or something like that?
>>   
> This sounds like it's just a bug to me.  The POP3 implementation is 
> fairly new, and it's entirely possible there are some problems with 
> encodingsparticularly since the javamail API docs are not entirely 
> clear on how some features should work.  If you can post a small sample 
> that can be run against both implementations, I'll gladly take a look at 
> it.
> 
> Rick
>> Mark
>>   
> 
> 
> 
Hello,

you need an email with e.g. ISO-8859-1 or ISO-8859-15 encoding
write in the subject: Test Ä-Ü-Ö
write the same in the body: Test Ä-Ü-Ö
check if it's a plain-text mail (it's easier to read this mail.

Retrieve this mail using the geronimo-mailapi. You can doublecheck the
result trying the sun javamail implementation. 
The subject ending is converted correctly. I think this is a result of bug:
GERONIMO-3842. But the encoding of the message-part only works with UTF-8.
There is no correct conversion to other charsets like ISO-8859-1.
This is how to receive the message and write into a file:
Store store;
Properties props = new Properties();
Session session = Session.getInstance(props);
FileOutputStream fos = null;

try {
store = session.getStore("pop3");
store.connect(SERVER, USERNAME, PASSWORD);
// Get folder
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
// Get directory
Message messages[] = folder.getMessages();

for (int i = 0; i < messages.length; i++) {
ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
messages[i].writeTo(baos);
// write mail into a file
File file = new File("path_to_file");
fos = new FileOutputStream(file);
fos.write(baos.toByteArray());
}
folder.close(true);
store.close();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally { 
if ( fos != null ) 
try { fos.close(); } catch ( IOException e ) { } 
} 

This is a sample mail created with mozilla thunderbirs:
>From - Fri May 30 15:59:50 2008
X-Mozilla-Status: 0001
X-Mozilla-Status2: 0080
X-Mozilla-Keys: 

Message-ID: <[EMAIL PROTECTED]>
Date: Fri, 30 May 2008 15:59:50 +0200
From: Mark Hoffmann <[EMAIL PROTECTED]>
User-Agent: Thunderbird 2.0.0.12 (X11/20080226)
MIME-Version: 1.0
To: [EMAIL PROTECTED]
Subject: test =?ISO-8859-1?Q?=F6=E4=F6=FC?=
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Test öäü


I hope this helps,

Mark
-- 
View this message in context: 
http://www.nabble.com/Encoding-problem-in-geronimo-javamail-implementation-tp17595809s134p17599604.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Encoding problem in geronimo-javamail implementation

2008-06-02 Thread maho77

Hello,

it seems to me that the geronimo javamail implementation has some encoding
problems. I use G2.1.1
I retrieve Message via POP3 and than I start parsing the parts in the
Message class. Everything works fine as long as I the mails are UTF-8 mails.
If there's an mail lets say with ISO-8859-1 the subject has the correct
encoding conversion, but not the content of the parts.

If I try the same with the javamail implementation from sun, it works well.

Do I have to set some properties or something like that?

Mark
-- 
View this message in context: 
http://www.nabble.com/Encoding-problem-in-geronimo-javamail-implementation-tp17595809s134p17595809.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Substitute geronimo javamail with sun implementation

2008-04-25 Thread maho77

Hello,

thank you, I have built the 1.5-SNAPSHOT version of
geronimo-javamail_1.4_mail. There are no exceptions anymore, so this
problems is fixed. 

replacing the jar in the repository is no solution because there are two
config-cars that contain dependencies to this jar config/javamail and
config/jee-specs. In my geronimo version they have dependency to
geronimo-javamail_1.4_mail_1.2,jar. So there are two solutions that I got to
work:
1. rename geronimo-javamail_1.4_mail_1.2,jar to
geronimo-javamail_1.4_mail_1.2_old,jar, copy
geronimo-javamail_1.4_mail_1.5-SNAPSHOT,jar to the 1.2 repository localtion
and rename it into geronimo-javamail_1.4_mail_1.2,jar. Restart the server.

2. Rebuild the two configs with modified pom's that link to the 1.5-SNAPSHOT
jar location and overwrite the configs-files in the repository. Restart the
server

I didn't found a solution without server restart until now. Even deploying
new configurations and using the client-artifact.properties didn't work. I'm
open for each help changing dependencies without a server restart.

Mark
-- 
View this message in context: 
http://www.nabble.com/Substitute-geronimo-javamail-with-sun-implementation-tp16824270s134p16895778.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: JAAS with a standalone client

2008-04-25 Thread maho77


djencks wrote:
> 
> I think that sending the server-side subject back to a client is apt  
> to be more than a philosophical problem. 
>  

As I spoke philosophical problem, I had in mind that I have to deal with a
standalone client instead of a web application.
JAAS works very well in web-apps. I wouldn't have such problems with a
web-app.


djencks wrote:
> 
>  In general, you don't know  
> what information other than the principals you are interested in may  
> be in the subject.  For instance in geronimo if you want to access a  
> remote secured web service you put the credentials for the web service  
> in the Subject.  These may be credentials for the server to access the  
> web service, not for the user of the server.  Leaking these to the  
> user/client program could be a serious security violation.  In order  
> to do this, you would need verification that the client program is  
> authorized to get the credentials: presumably this would involve  
> signing the code and communicating this somehow to the server.
> 

Now I understand. Yes, you're absolutely right. I only saw my simple user
and group principals but there could be more. 
In my case the client should only get the information that belong to him. I
already solved this problem using an stateless bean.


djencks wrote:
> 
> Instead of this likely-to-be-risky exposure, if you just make the user  
> roles available to the client, you are unlikely to be sending  
> particularly sensitive information.  Could I ask what kind of security  
> system you are using on the client that requires principals?
> 

I use the Eclipse RCP. In version 3.4 JAAS support was introduced. So I use
JAAS on the client side too. What I currently do is mapping roles only to
group principals on server-side. So in my system there is one group for each
role. The groups are my roles. The client gets the groups from a stateless
bean and turns them into my own ClientRolePrincipals. I want the
authorization on the client-side too. The RCP can handle certain parts. I
just want to write my permissions and an own Policy implementation. In the
first step I introduced only realm, username, password authentication. 

I would like to thank you for your comments. Now I think that my stateless
bean solution isn't as bad as I thought.

Mark
-- 
View this message in context: 
http://www.nabble.com/JAAS-with-a-standalone-client-tp16824275s134p16895769.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Substitute geronimo javamail with sun implementation

2008-04-24 Thread maho77

Hello,

the pop3 problems are solved on my 2.0.2 with the 1.5-SNAPSHOT of the
geronimo-mail svn-trunk build. I installed the new jar into the repository.
Now I followed your instructions and built config/javamail and
config/jee-specs because these booth configs have a dependency to
org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/1.2. So i changed
the pom's to the new version of the
org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/1.5-SNAPSHOT. I gave
them other names, so I got config/javamail2 and config/jee-specs2 with the
new dependency. I deployed both plans, changed the var/config/config.xml as
well as the var/config/client_artifact_aliases.properties:
org.apache.geronimo.configs/javamail//car=org.apache.geronimo.configs/javamail2/2.0.2/car
org.apache.geronimo.configs/jee-specs//car=org.apache.geronimo.configs/jee-specs2/2.0.2/car
Even after a server restart, geronimo took the old
geronimo-javamail_1.4_mail-1.2 implementation.:-(

The problem is the dependency to jee-specs. In the system module view the
old jee-spec still has its old children. My new  jee-specs2 has no child. So
I modified the pom's of config/javamail and config/jee-specs that I get the
same car like the installed ones with the only difference, the dependendy to
the 1.5-SNAPSHOT-jar. After the build I overwrote the files in the
repository with the versions from the build. I started the server and it
worked. I have to say that the plan I got are module plans you talked about
plugins, is this the same?

BUT you can reach the same result by renaming the 
original geronimo-javamail_1.4_mail-1.2.jar into
geronimo-javamail_1.4_mail-1.2_old.jar for instance and than copy your
geronimo-javamail_1.4_mail-1.5-SNAPSHOT.jar into the directory of the
1.2-jar and rename the new 1.5-SNAPSHOT version into
geronimo-javamail_1.4_mail-1.2.jar. Restart the server and it works.

I thought there is a possibility without server restart. If I modify the
client_artifact_aliases.properties, do I have to restart the server to make
my changes apply?

Mark


djencks wrote:
> 
> I guess we have one jar where sun has 2?  If so I think you need to  
> copy the javamail config project, rename it, and replace the  
> dependency on our jar with dependencies on the sun jars in the pom.   
> If you were using g 2.1 you could arrange it so that when your plugin  
> was installed it would replace ours, but this can't be automated in  
> 2.0.2.  In 2.0.2 I think you can map the plugins "by hand" by  
> including lines like this in var/config/artifact_aliases.properties:
> 
> org.apache.geronimo.configs/javamail/2.0.2/car=com.mark/sun-javamail/ 
> 1.0-SNAPSHOT/car
> org.apache.geronimo.configs/javamail//car=com.mark/sun-javamail/1.0- 
> SNAPSHOT/car
> 
> There's a good chance you'll only need one of these lines, but I'm  
> not sure which.
> 
> As Rick said, please let us know what pop3 problems you are seeing so  
> we can fix them.
> 
> thanks
> david jencks
> 

-- 
View this message in context: 
http://www.nabble.com/Substitute-geronimo-javamail-with-sun-implementation-tp16824270s134p16850768.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: JAAS with a standalone client

2008-04-23 Thread maho77



djencks wrote:
> 
> 
> Well, I kind of hope you can't get the server side Subject into your  
> client :-).  Could I suggest that doing so might not be appropriate  
> from a security standpoint?  You don't really know what other  
> sensitive info might have been added to the Subject.  Also, I think  
> you would be tying your client to a particular login module which  
> might not be an appropriate coupling.
> 
> What I would suggest considering is to have a server component (ejb?)  
> that maps the principals in the Subject to a set of (String) roles  
> that are sent back to the client, and that you base the UI stuff on  
> these roles.  It's pretty silly that there isn't a getUserRoles()  
> call in the ee specs but that is what we have to live with now.   
> Anyway I think this would prevent accidentally sending sensitive info  
> to the client, and provide some decoupling between the specific login  
> module you happen to be using now and your client.
> 
> There might be something I've overlooked here, so feel free to try to  
> change my mind :-)
> 
> thanks
> david jencks
> 
> 
> 

Hello,

I currently use a login module that calls a stateless bean with the user
credentials. The bean itself takes the user that accesses the bean a return
all his groups to the client. The client turns the groups into principals
and so on

This works, but I don't like this way. 

On a client there is a need to hide UI elements from the user in some ways,
The user wants to login one time to the client.
Than I have to hide some UI elements e.g. for the whole admin module, if the
user has no access rights for it. And further I only need this information
for hiding UI elements. The logic happens on the geronimo server and the ejb
components are secured with roles. That means if I want to access to the
logic, the server security handles the access, not the client. The client
only has to know the user credentials and the realm. 

I know it's a philosophical problem. So see this reply just as a statement,
from my point of view. I have no web client that's the problem I have ;-)

Have a nice day

Mark
-- 
View this message in context: 
http://www.nabble.com/JAAS-with-a-standalone-client-tp16824275s134p16844548.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



update geronimo mail configuration from geronimo-javamail_1.4_mail-1.2 to 1.4_mail-1.5-SNAPSHOT

2008-04-23 Thread maho77

Hello,

yesterday I have posted a problem with Messages in the geronimo javamail
package 1.4-1.2. In the meantime I build version 1.4-1.5-SNAPSHOT from the
svn trunk. How can I tell my geronimo2.0.2 to use the newer version instead
of the 1.2?

I tried to rename the old jar in the 1.2 repository folder, put in the new
version and rename it that it has the name of the old jar. After a server
restart it worked without any exceptions. The same worked with the sun
implementation. 
But I don't like this way.

What is the official way to change such a configuration in Geronimo? I know
there are dependency to other packages (geronimo.config/jee-specs and
geronimo.config/activation) But I didn't found any deployment plans for them
to see how the dependencies are configured. 

Does the var/config/client_artifact_aliases.properties help me in any way? I
already tried to substitute the old jar with the new one but it seems to
work only for system modules and not for jars that are deployed in the
common libs section of the frontend.

Thank you,

Mark
-- 
View this message in context: 
http://www.nabble.com/update-geronimo-mail-configuration-from-geronimo-javamail_1.4_mail-1.2-to-1.4_mail-1.5-SNAPSHOT-tp16834723s134p16834723.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Substitute geronimo javamail with sun implementation

2008-04-23 Thread maho77



Rick McGuire wrote:
> 
> I think others will need to help you with the configuration, but please 
> report the errors you're seeing with the Geronimo POP3 implementation.  
> We'll see if we can get them fixed for you. 
> 
> Rick
> 

I think the problem I have has something to do with 
http://issues.apache.org/jira/browse/GERONIMO-3539 GERONIMO-3539 . Further
there is another solved bug regarding some exceptions in the Message
implementation. Is it possible to build only the mail-module and mail-config
from svn-trunk and install it on my geronimo 2.0.2 installation? Or do I
have to build the whole Geronimo from scratch (Which doesn't work)? I have
to say that I have no experiences with maven.

Mark
-- 
View this message in context: 
http://www.nabble.com/Substitute-geronimo-javamail-with-sun-implementation-tp16824270s134p16834581.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



JAAS with a standalone client

2008-04-22 Thread maho77

Hello,
I have a standalone client, no jee-application client. Now I want to login
to the server using JAAS, which works until now. But the only principal I
get from the subject is a server principal. But I need all
GeronimoGroupPricipals and GeronimoUserPrincipals of the authneticated user
in the subject on my client, to enable or disable UI elements. I
investigated in the source code but found no solution for this. Is it
possible to get the GeronimoPricipals to the client or can I get the server
subject in any way?

Currently I have a bean that does the same as the corresponding SQLRealm. It
provides the user and group depending on the user that is currently logged
in. But I want to avoid this solution.

Can you give me an hint?

Mark
-- 
View this message in context: 
http://www.nabble.com/JAAS-with-a-standalone-client-tp16824275s134p16824275.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Substitute geronimo javamail with sun implementation

2008-04-22 Thread maho77

Hello,
When I use the geronimo-mail implementation to access pop3 folders in a
bean, I get exceptions for some of the messages. So i tried a sample main
application with the sun implementation without any errors. Now I wanted
Geronimo to use the sun implementation instead of geronimo-mail. 

My first step was to get the Geronimo implementation running. So I created
an GBean:



http://geronimo.apache.org/xml/ns/deployment-1.2";>


com.mvolution.mti.commons
POPMailGBean
1.0
car



org.apache.geronimo.modules
geronimo-mail
2.0.2
jar


org.apache.geronimo.configs
javamail
2.0.2
car


org.apache.geronimo.modules
geronimo-management
2.0.2
jar





popserver
username
110


pop3
ger:/POPMailSession



This works very well in my Bean with the @Resource annotation.
I want this with the sun implemention.

So I installed the javamail.jar and activation.jar from sun on Geronimo. The
problem is the dependency org.apache.geronimo.configs/javamail/2.0.2/car in
the GBean. There is an geronimo.plugin.xml in
rg.apache.geronimo.configs/javamail/2.0.2/car which shows the dependency to
the org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/1.2/jar.

How can I create such a configuration? Do I have to create it with a
deployment-plan? What schema do I have to use?

Thank you for your help.

Mark
-- 
View this message in context: 
http://www.nabble.com/Substitute-geronimo-javamail-with-sun-implementation-tp16824270s134p16824270.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Circular reference problem

2007-12-12 Thread maho77


Jacek Laskowski wrote:
> 
> On Dec 11, 2007 8:32 PM, maho77 <[EMAIL PROTECTED]> wrote:
> What's "a bean"? Is it an ejb or a managed (backing) bean or merely a
> pojo?
> 

ModifyBean is an EJB JAR containing stateless bean and a JPA entity, the
stateless bean contains a method 
public Object modify(Object o, String languageCode)

It parses the give o for annotation from annotations.jar and catches the
translated values from the database with JPA sets translated values to  the
annotated fields using reflections.

ModifyBeans modifies other JPA Entities, POJO's whatever conains the
annotations.

BeanA and BeanB are also EJB JAR's. BeanA  containis JPA entity EnitityA and
a stateless bean with the methods
EntityA EntityAImpl.getEntityA() and
EntityA EntityAImpl.getEntityA(String languageCode) 

@Stateless
public class BeanAImpl implements ...

@EJB
ModifyBeanRemote modBean;

public EntityA getEntity() {
  //gets the entity
}

public EntityA getEntity(String langCode) {
  EntityA a = getEntity();
  return (BeanA)modBean.modify(a, langCode)
}

}

BeanB EJB JAR is a similar principle



> BeanA, BeanB depend on annotations.jar
> BeanA, BeanB depend on ModifyBean
> ModifyBean depend on annotations.jar
> 
> Right?
> 

Right, but ModifyBean also depends on BeanA and BeanB.



> ModifyBean.modify(entities) would do the trick, right?
> 

Right



> You might take a look at the interceptors feature of ejb3. It lets you
> intercept business method calls as well as lifecycle events and
> therefore do something in addition to the original call or a lifecycle
> change.
> 

I know this feature but the problem occures on execution time. I can deploy
the whole 3 EJB JAR's. But if I call 
BeanAImpl.getEntitiyA("ENG") from a client I get an exception that says that
EntityA is unkown to the ModifyBean.

10:22:17,260 ERROR [OpenEJB] The bean instances business method encountered
a system exception: null
java.lang.reflect.UndeclaredThrowableException
at $Proxy156.modify(Unknown Source)
at beana.impl.BeanAImpl.getEntityA(EntityAImpl.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:203)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120)
at
org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at 
org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73)
at
org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117)
at java.lang.Thread.run(Thread.java:810)
Caused by: 
java.lang.ClassNotFoundException: beana.entites.EntityA
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:163)
at org.apache.openejb.util.Classes.forName(Classes.java:48)
at
org.apache.openejb.core.ivm.EjbObjectInputStream.resolveClass(EjbObjectInputStream.java:37)
at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1568)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1490)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1723)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:363)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.copyObj(BaseEjbProxyHandler.java:516)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.copyArgs(BaseEjbProxyHandler.java:471)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:274)
at
org.apache.openejb.util.proxy.Jdk13Invoc

Circular reference problem

2007-12-11 Thread maho77

Hello,

I have a problem with circular references. I have the following
constelation:

- I have a annotations.jar deployed as common lib. This jar contains some
annotations
- I have a bean (I call it ModifyBean) that modifies objects that contain
these annotations. 
- The ModifyBean will be used by several other beans (BeanA, BeanB, ...) The
ModifyBean has to be independent from BeanA, BeanB, ...
- The ModifyBean is dependent from the annotation.jar, because it looks
after this annotations in the objects that have to be modified
- The other beans BeanA, BeanB are also dependend from annotations.jar
because some entities make use of the annotations. BeanA and BeanB are also
dependent from ModifyBean because the BeanA and BeanB calling the modify
method from ModifyBean to modify the entities.

My problem is that the ModifyBean has to know BeanA and BeanB, to know the
entities which should be modified. The deployment of BeanA, BeanB and the
ModifyBean failes. Further I don't want that the ModifyBean knows BeanA or
BeanB, because I  have some other beans that should be modified by the
ModifyBean and I don't want add the dependencies to openejb.xml each time I
have to add a new bean that want's to use the ModifyBean.

Is this solveable?

Thanks a lot,
Mark
-- 
View this message in context: 
http://www.nabble.com/Circular-reference-problem-tp14281457s134p14281457.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: EntityExistsException: Attempt to persist detached object

2007-11-27 Thread maho77



djencks wrote:
> 
> My experience is that to get openjpa sequences to work you NEED a non  
> transactional non-jta-datasource specified in your persistence.xml
> 
>   yyyDataSouurce
> 
> where the configuration of yyyDataSouurce includes
> 
> 
> 
> In particular it can't be the same datasource you use for the jta- 
> data-source
> 
> thanks
> david jencks
> 
> 

Hello,

thanks, I did it like you advised and I worked. But not as expected. I
received the following exception:

org.apache.openjpa.util.StoreException: Attempt to update the sequence table
"ID_GENERATOR" failed.  The sequence table is typically created when you run
the mappingtool's refresh action on any datastore identity class. If you
have not run the mappingtool but want to create the sequence table, run:
java org.apache.openjpa.jdbc.kernel.TableJDBCSeq -action add
at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3849)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:75)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:346)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:247)
at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:557)
at 
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:450)
at 
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:426)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:541)
at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:501)
at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2770)
at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:940)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1884)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1844)
at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1762)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:499)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:239)
at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:140)
at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:75)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:219)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120)
at
org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at 
org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73)
at
org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117)
at java.lang.Thread.run(Thread.java:810)

With this annotations in my entity:
@TableGenerator(name="GroupIdGen", table="ID_GENERATOR",
pkColumnName="name", valueColumnName="id_value",
pkColumnValue="group_table", allocationSize=1)
@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="GroupIdGen")

and the table looks like this:
CREATE TABLE ID_GENERATOR (
name VARCHAR(100) NOT NULL,
id_value INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(name)
);

So according to this exception I changed the table to:
CREATE TABLE ID_GENERATOR (
 

Re: EntityExistsException: Attempt to persist detached object

2007-11-26 Thread maho77



Jacek Laskowski wrote:
> 
> 
> Hi,
> 
> Could you send us the openjpa logs - it should be in
> var/log/geronimo.log? I assume they're generated according to the
> property in persistence.xml:
> 
> 
> 
> I wonder why you do the following in the stand-alone client code:
> 
>  MTIGroup g1 = new MTIGroup();
>  g1.setId(2);
>  g1.setName("testGroup");
> 
> Note the setId() call.
> 
> The null from
> org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.getConnection(AbstractJDBCSeq.java:162)
> call suggests that there might be issues with geronimo plan file of
> the application. You've got
> xxxDataSouurce in persistence.xml
> file - there's 'u' doubled. Is that correct? Send us the geronimo plan
> you're using with the application. Is the data source one of the
> default data sources of Geronimo?
> 
> I have never worked with mysql and TableGenerator for jpa-based
> application in Geronimo so I'm asking these question to avoid dealing
> with the setup *if* the issue is simpler to fix without it.
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 
Hi,
I've attached my bean including the source files:

Here is the code of my stand-alone client:
InitialContext ic = null;
Properties properties = new Properties();

properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
properties.put(Context.PROVIDER_URL,"ejbd://localhost:4201");

try {
ic = new InitialContext(properties);
TestRemote lar = 
(TestRemote)ic.lookup("TestImplRemote");

MTIGroup g1 = new MTIGroup();
g1.setName("test");
g1.setDescription("test description");
lar.createGroup(g1);

} catch (NamingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}

The XXXDataSource is a MySQL XA DataSource, driver revision is 5.0.7.
Here is the database table create-command:

CREATE TABLE group_table (
id INTEGER UNSIGNED NOT NULL,
name VARCHAR(100) NOT NULL,
description TEXT NOT NULL,
UNIQUE KEY(name),
PRIMARY KEY (id)
);

I have also tried 
CREATE TABLE group_table (
id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
name VARCHAR(100) NOT NULL,
description TEXT NOT NULL,
UNIQUE KEY(name),
PRIMARY KEY (id)
);

This configuration end with the following:
0  XXX  TRACE  [Thread-72] openjpa.Runtime - Setting the following
properties from "?" into configuration: {openjpa.Multithreaded=true,
openjpa.RestoreState=all,
[EMAIL PROTECTED],
openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100),
openjpa.AutoDetach=close,
openjpa.MetaDataFactory=jpa(Types=entities.MTIGroup),
openjpa.TransactionMode=managed, openjpa.jdbc.SynchronizeMappings=false,
openjpa.ConnectionFactoryMode=managed,
[EMAIL PROTECTED],
openjpa.Id=XXX, openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=true),
openjpa.Log=DefaultLevel=TRACE,SQL=TRACE,
openjpa.jdbc.UpdateManager=operation-order,
openjpa.NontransactionalRead=true,
javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl,
openjpa.Optimistic=true, openjpa.DetachState=all, openjpa.DataCache=false}
1  XXX  TRACE  [Thread-72] openjpa.MetaData - Scanning resource
"META-INF/orm.xml" for persistent types.
2  XXX  TRACE  [Thread-72] openjpa.MetaData - parsePersistentTypeNames()
found [entities.MTIGroup].
2  XXX  TRACE  [Thread-72] openjpa.MetaData - Found 1 classes with metadata
in 1 milliseconds.
0  XXX  TRACE  [Thread-72] openjpa.Runtime - Setting the following
properties from "?" into configuration: {openjpa.Multithreaded=true,
openjpa.RestoreState=all,
[EMAIL PROTECTED],
openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100),
openjpa.AutoDetach=close, openjpa.BrokerImpl=non-finalizing,
openjpa.MetaDataFactory=jpa(Types=entities.MTIGroup),
openjpa.TransactionMode=managed, openjpa.jdbc.SynchronizeMappings=false,
openjpa.ConnectionFactoryMode=managed,
[EMAIL PROTECTED],
openjpa.Id=XXX, openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=true),
openjpa.Log=DefaultLevel=TRACE,SQL=TRACE,
openjpa.jdbc.UpdateManager=operation-order,
openjpa.NontransactionalRead=true,
javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl,
openjpa.Optimistic=true, openjpa.BrokerFactory=jdbc,
openjpa.DetachState=all, openjpa.DataCache=false}
324  XXX  TRACE  [Thread-72] openjpa.Enhance - "entities/MTIGroup" requires
runtime enhancement: true
350  XXX  TRACE  [Thread-72] openjpa.MetaData - Loading metadata for "class
entities.MTIGroup" under mode "[META][QUERY]".
350  XXX  TRACE  [Thread-72] openjpa.MetaData - Parsing class
"entities.MTIGroup".
350  XXX  TRACE  [Thread-72] openjpa.MetaData - Parsing package
"entities.MTIGroup".
358  XXX 

Re: EntityExistsException: Attempt to persist detached object

2007-11-26 Thread maho77



Jacek Laskowski wrote:
> 
> On Nov 22, 2007 7:52 PM, maho77 <[EMAIL PROTECTED]> wrote:
> 
>>  I have already tried em.persist(em.merge(group)). It didn't work. I the
>> meantime I found out that the problem obviously lies in the
>> @TableGenerator
>> thing. I removed it and set the id by hand and it worked fine. So I hope
>> your right. with the primary key.
>> So only to understand it right, do I have to set the
>> private int id = 0;
>> by hand or is the attribute in the @TableGenerator enough. I ask because
>> I
>> tried it with private int id; which also refused to work. On monday I
>> will
>> be back in the office and try it.
> 
> I need to try it out myself too as it could be an issue with our
> integration with openjpa. Anyway, don't touch primary key of the
> entity as it's reserved for a jpa provider's use. Let the default
> initial value be set for it.
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

Hello,

I tried it with an unitialized id field and ran into another exception:

09:40:29,126 WARN  [Transaction] Unexpected exception from beforeCompletion;
transaction will roll back

org.apache.openjpa.persistence.PersistenceException: null
at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.getConnection(AbstractJDBCSeq.java:162)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:341)
at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:247)
at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:557)
at 
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:450)
at 
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:426)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:541)
at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:501)
at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2770)
at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:940)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1884)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1844)
at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1762)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:499)
at
org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:239)
at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:140)
at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:75)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:219)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120)
at
org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at 
org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73)
at
org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117)
at java.lang.Thread.run(Thread.java:810)
Caused by: 
javax.transaction.SystemException
at
org.apache.openjpa.ee.RegistryManagedRuntime$TransactionManagerRegistryFacade.suspend(RegistryManagedRuntime.java:176)
at
org.apache.openjpa.jdbc.kernel.AbstractJDB

Re: EntityExistsException: Attempt to persist detached object

2007-11-22 Thread maho77



Jacek Laskowski wrote:
> 
> On Nov 22, 2007 3:12 PM, maho77 <[EMAIL PROTECTED]> wrote:
> 
> It's a guess - shot in the dark, but worth to try out - why do you
> assign -1 to the entity primary key? 0 is the default value so
> everything that's different than the default value is likely
> considered as a valid persistent identifier.
> 
> You may eventually want to run the sample with
> em.persist(em.merge(group)).
> 
> Jacek
> 
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl
> 
> 

Hi Jacek,
 I have already tried em.persist(em.merge(group)). It didn't work. I the
meantime I found out that the problem obviously lies in the @TableGenerator
thing. I removed it and set the id by hand and it worked fine. So I hope
your right. with the primary key.
So only to understand it right, do I have to set the 
private int id = 0; 
by hand or is the attribute in the @TableGenerator enough. I ask because I
tried it with private int id; which also refused to work. On monday I will
be back in the office and try it. 

Mark
-- 
View this message in context: 
http://www.nabble.com/EntityExistsException%3A-Attempt-to-persist-detached-object-tf4856534s134.html#a13901667
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



EntityExistsException: Attempt to persist detached object

2007-11-22 Thread maho77

Hello, I get the following Exception, when I try to persist an Entity:

14:53:06,841 ERROR [LoginAdminImpl] Fehler beim Speichern der MTIGroup

org.apache.openjpa.persistence.EntityExistsException: Attempt to persist
detached object "[EMAIL PROTECTED]".
FailedObject: [EMAIL PROTECTED]
at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2358)
at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2216)
at
org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005)
at
org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
at
org.apache.geronimo.persistence.CMPEntityManagerTxScoped.persist(CMPEntityManagerTxScoped.java:83)
at beans.LoginAdminImpl.createGroup(LoginAdminImpl.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:203)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:212)
at
org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:120)
at
org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at 
org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:73)
at
org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
at org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:117)
at java.lang.Thread.run(Thread.java:810)

This is the Entity:

@Entity
@Table(name="group_table")
public class MTIGroup implements Serializable, IMTIGroup {

private int id = -1;
private String name = new String();
private String description = new String();

public MTIGroup() {
}

@TableGenerator(name="GroupIdGen", table="ID_GENERATOR",
pkColumnName="name", valueColumnName="id_value",
pkColumnValue="group_table", initialValue=0, 
allocationSize=1)
@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="GroupIdGen")
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

}

This is the StatefulBean-Method:

@PersistenceContext(unitName="xxx")
private EntityManager em;
...
public void createGroup(MTIGroup group) {
if (group != null) {
try {
em.persist(group);
}
catch (Exception e) {
logger.error("Error saving MTIGroup", e);
}
}
}

This is the stand-alone client code:
InitialContext ic = null;
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
properties.put(Context.PROVIDER_URL,"ejbd://localhost:4201");

try {
ic = new InitialContext(properties);
TestImplRemote lar = 
(TestImplRemote)ic.lookup("TestImplEJBRemote");
MTIGroup g1 = new MTIGroup();
g1.setId(2);
g1.setName("testGroup");
g1.setDescription("Description for testGroup");
lar.createGroup(g1);
} catch (NamingException e) {
e.printStackTrace();
} catch (Exception e) {

Re: Problem with JPA MySQL and Geronimo2.0.2

2007-11-06 Thread maho77



Jay D. McHugh-2 wrote:
> 
> 
> Hey Mark,
> 
> That one caught me too.
> 
> The JPA spec says that you have to use a mapping table to do a 
> one-to-many relationship.
> 
> But, OpenJPA has a proprietary annotation that you can use if you know 
> that you will not be using any other persistence engines:
> 
> @ElementJoinColumn(name="" 
> referencedColumnName="")
> 
> That should allow you to bypass the 'standard' JPA relationship mapping 
> and get your one-to-many working.
> 
> Jay
> 
> 
> 
> 
> 

Thank you Jay
-- 
View this message in context: 
http://www.nabble.com/Problem-with-JPA-MySQL-and-Geronimo2.0.2-tf4758860s134.html#a13610277
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Problem with JPA MySQL and Geronimo2.0.2

2007-11-06 Thread maho77

Hello,
I have connected a MySQL Database to Geronimo via MySQL XA Pool. Further I
have two entities:
Country and Region. In the country Entity I mapped the Region as follows:

@OneToMany(cascade = ALL, targetEntity = entities.orig.Region.class,
mappedBy = "country") 
@OrderBy("name ASC")
public Collection getRegion() {
return region;
}

In Region I mapped Country:
@ManyToOne(targetEntity=entities.orig.Country.class, cascade = { MERGE,
REFRESH })
@JoinColumn(name="country_id", referencedColumnName = "id", table =
"region")
public Country getCountry() {
return country;
}

I have the following schema for region:

CREATE TABLE region (
id INT NOT NULL AUTO_INCREMENT,
country_id INT DEFAULT 0 NOT NULL,
name VARCHAR(255) DEFAULT '' NOT NULL,
info_id INT DEFAULT 0 NOT NULL,
default_region BIT DEFAULT 0 NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM; //I tried ENGINE=InnoDB too with the same results
alter table region add foreign key(country_id) references country (id)

CREATE TABLE country (
id INT(4) NOT NULL AUTO_INCREMENT,
countrycode CHAR(2) DEFAULT '' NOT NULL,
name VARCHAR(255) DEFAULT '' NOT NULL,
default_region_id INT(2) DEFAULT 0 NOT NULL,
UNIQUE KEY(countrycode),
PRIMARY KEY (id)
) ENGINE=MyISAM // and also InnoDB;

This is my persistence.xml:

TEST_XA
entities.orig.Country
entities.orig.Region







When I run this I get the following exception from OpenJPA:

org.apache.openjpa.persistence.PersistenceException: Not unique table/alias:
't0' {prepstmnt 10955888 SELECT t0.id, t0.changed, t0.created,
t0.default_region, t1.id, t1.changed, t1.created, t1.infotext,
t1.user_changed, t1.user_created, t0.name, t0.user_changed, t0.user_created
FROM bo_test.region t0 INNER JOIN bo_test.region t0 ON t0.id = t0.Region_id
LEFT OUTER JOIN bo_test.info t1 ON t0.info_id = t1.id WHERE t0.country_id =
? [params=(int) 43]} [code=1066, state=42000]

When I use a mapping table and change the mapping it works:
Country:
@OneToMany(cascade = REFRESH, targetEntity = entities.Region.class, 
fetch =
EAGER) 
@OrderBy("name ASC")
@JoinTable(name="country_region", joinColumns =
@JoinColumn(name="country_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name="region_id", referencedColumnName =
"id"))
public Collection getRegion() {
return region;
}

Region:
@ManyToOne(targetEntity=entities.Country.class)
@JoinColumn(name = "country_id", referencedColumnName = "id", table =
"country_region")
public Country getCountry() {
return country;
}

What it going wrong here? Can anybody help me?

Thanks,
Mark


-- 
View this message in context: 
http://www.nabble.com/Problem-with-JPA-MySQL-and-Geronimo2.0.2-tf4758860s134.html#a13609313
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.