2016-10-19 2 views
2

J'ai une configuration assez simple où j'ai une UserEntity et une UserStatisticEntity correspondant. Je veux que ce soit une relation unidirectionnelle, où UserEntity détient la référence. UserStatisticEntity doit être persisté et supprimé avec UserEntity, pour cela j'utilise CascadeType.PERSIST et REMOVE. Je travaille avec Glassfish4 et Eclipselink. À l'heure actuelle, je le fais comme ceci:
UserEntity:JPA CascadeType persiste ne fonctionne pas

@Entity 
public class UserEntity extends AdditionalEntityInformation { 
@Id 
@SequenceGenerator(name="seqGenUserId") 
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="seqGenUserId") 
private long userId; 
@OneToOne(cascade={CascadeType.PERSIST, CascadeType.REMOVE}) 
@JoinColumn(name="STAT_ID", unique=true, nullable=false, updatable=false, insertable=false) 
@Basic(optional=false) 
@Column(nullable=false) 
private UserStatisticEntity stats; 
... 
public UserEntity(String username, String passwordHash, UserStatisticEntity stats) { 
     this.username = username; 
     this.passwordHash = passwordHash; 
     this.stats = stats; 
     this.loggedIn = false; 
    } 
} 

UserStatisticEntity:

@Entity 
public class UserStatisticEntity extends StatisticEntity { 
private static final long serialVersionUID = 1L; 

@Basic(fetch=FetchType.EAGER, optional=true) 
private Date lastLogin; 
} 

ce Unfortunatly ne fonctionne pas, quand je persiste un UserEntity, le UserStatisticEntity correspondant n'est pas persisté. ?
Qu'est-ce que je manque (il est probablement très simple et évident, mais pour la vie de moi je ne suis pas le vois)

Edit: Les tableaux suivants ont été créés à partir des classes (le choses importantes):
UserEntity:

USERID bigint(20) 
STATS longblob 

UserStatisticEntity:

ID bigint(20) 
LASTLOGIN datetime 

Le code suivant est utilisé pour créer les deux entités et les persistent.

UserStatisticEntity stats = new UserStatisticEntity(0, 0, 0, null); 
UserEntity u = new UserEntity(username, hashingBean.hashString(password), stats); 
em.persist(u); 

L'des œuvres persistent de UserEntity, mais ne sont pas persistent à UserStatisticEntity en cascade.
L'exploitation forestière que j'ai:

2016-10-19T13:00:00.925+0200|Konfiguration: The access type for the persistent class [class de.fh_dortmund.hansen.chat.entity.AdditionalEntityInformation] is set to [FIELD]. 
2016-10-19T13:00:00.935+0200|Konfiguration: The access type for the persistent class [class de.fh_dortmund.hansen.chat.entity.UserEntity] is set to [FIELD]. 
2016-10-19T13:00:00.936+0200|Konfiguration: The access type for the persistent class [class de.fh_dortmund.hansen.chat.entity.StatisticEntity] is set to [FIELD]. 
2016-10-19T13:00:00.937+0200|Konfiguration: The access type for the persistent class [class de.fh_dortmund.hansen.chat.entity.UserStatisticEntity] is set to [FIELD]. 
2016-10-19T13:00:00.937+0200|Konfiguration: The access type for the persistent class [class de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity] is set to [FIELD]. 
2016-10-19T13:00:00.940+0200|Konfiguration: The column name for element [createdAt] is being defaulted to: CREATEDAT. 
2016-10-19T13:00:00.942+0200|Konfiguration: The column name for element [updatedAt] is being defaulted to: UPDATEDAT. 
2016-10-19T13:00:00.942+0200|Konfiguration: The alias name for the entity class [class de.fh_dortmund.hansen.chat.entity.UserEntity] is being defaulted to: UserEntity. 
2016-10-19T13:00:00.942+0200|Konfiguration: The table name for entity [class de.fh_dortmund.hansen.chat.entity.UserEntity] is being defaulted to: USERENTITY. 
2016-10-19T13:00:00.946+0200|Konfiguration: The column name for element [createdAt] is being defaulted to: CREATEDAT. 
2016-10-19T13:00:00.947+0200|Konfiguration: The column name for element [stats] is being defaulted to: STATS. 
2016-10-19T13:00:00.948+0200|Konfiguration: The column name for element [loggedIn] is being defaulted to: LOGGEDIN. 
2016-10-19T13:00:00.948+0200|Konfiguration: The column name for element [userId] is being defaulted to: USERID. 
2016-10-19T13:00:00.948+0200|Konfiguration: The column name for element [passwordHash] is being defaulted to: PASSWORDHASH. 
2016-10-19T13:00:00.949+0200|Konfiguration: The column name for element [username] is being defaulted to: USERNAME. 
2016-10-19T13:00:00.949+0200|Konfiguration: The column name for element [updatedAt] is being defaulted to: UPDATEDAT. 
2016-10-19T13:00:00.949+0200|Konfiguration: The alias name for the entity class [class de.fh_dortmund.hansen.chat.entity.UserStatisticEntity] is being defaulted to: UserStatisticEntity. 
2016-10-19T13:00:00.950+0200|Konfiguration: The alias name for the entity class [class de.fh_dortmund.hansen.chat.entity.StatisticEntity] is being defaulted to: StatisticEntity. 
2016-10-19T13:00:00.950+0200|Konfiguration: The table name for entity [class de.fh_dortmund.hansen.chat.entity.StatisticEntity] is being defaulted to: STATISTICENTITY. 
2016-10-19T13:00:00.950+0200|Konfiguration: The column name for element [createdAt] is being defaulted to: CREATEDAT. 
2016-10-19T13:00:00.951+0200|Konfiguration: The column name for element [logouts] is being defaulted to: LOGOUTS. 
2016-10-19T13:00:00.951+0200|Konfiguration: The column name for element [messages] is being defaulted to: MESSAGES. 
2016-10-19T13:00:00.951+0200|Konfiguration: The column name for element [id] is being defaulted to: ID. 
2016-10-19T13:00:00.952+0200|Konfiguration: The column name for element [logins] is being defaulted to: LOGINS. 
2016-10-19T13:00:00.952+0200|Konfiguration: The column name for element [updatedAt] is being defaulted to: UPDATEDAT. 
2016-10-19T13:00:00.952+0200|Konfiguration: The table name for entity [class de.fh_dortmund.hansen.chat.entity.UserStatisticEntity] is being defaulted to: USERSTATISTICENTITY. 
2016-10-19T13:00:00.952+0200|Konfiguration: The column name for element [lastLogin] is being defaulted to: LASTLOGIN. 
2016-10-19T13:00:00.953+0200|Konfiguration: The column name for element [createdAt] is being defaulted to: CREATEDAT. 
2016-10-19T13:00:00.953+0200|Konfiguration: The column name for element [logouts] is being defaulted to: LOGOUTS. 
2016-10-19T13:00:00.954+0200|Konfiguration: The column name for element [messages] is being defaulted to: MESSAGES. 
2016-10-19T13:00:00.954+0200|Konfiguration: The column name for element [id] is being defaulted to: ID. 
2016-10-19T13:00:00.955+0200|Konfiguration: The column name for element [logins] is being defaulted to: LOGINS. 
2016-10-19T13:00:00.956+0200|Konfiguration: The column name for element [updatedAt] is being defaulted to: UPDATEDAT. 
2016-10-19T13:00:00.956+0200|Konfiguration: The alias name for the entity class [class de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity] is being defaulted to: CommonStatisticEntity. 
2016-10-19T13:00:00.956+0200|Konfiguration: The table name for entity [class de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity] is being defaulted to: COMMONSTATISTICENTITY. 
2016-10-19T13:00:00.956+0200|Konfiguration: The column name for element [createdAt] is being defaulted to: CREATEDAT. 
2016-10-19T13:00:00.957+0200|Konfiguration: The column name for element [logouts] is being defaulted to: LOGOUTS. 
2016-10-19T13:00:00.957+0200|Konfiguration: The column name for element [endDate] is being defaulted to: ENDDATE. 
2016-10-19T13:00:00.957+0200|Konfiguration: The column name for element [messages] is being defaulted to: MESSAGES. 
2016-10-19T13:00:00.957+0200|Konfiguration: The column name for element [id] is being defaulted to: ID. 
2016-10-19T13:00:00.958+0200|Konfiguration: The column name for element [startingDate] is being defaulted to: STARTINGDATE. 
2016-10-19T13:00:00.958+0200|Konfiguration: The column name for element [logins] is being defaulted to: LOGINS. 
2016-10-19T13:00:00.958+0200|Konfiguration: The column name for element [updatedAt] is being defaulted to: UPDATEDAT. 
2016-10-19T13:00:00.958+0200|Konfiguration: The sequence name for the sequence generator named [seqGenStatId] defined on [field id] from [field id] is being defaulted to: seqGenStatId. 
2016-10-19T13:00:00.959+0200|Konfiguration: The sequence name for the sequence generator named [seqGenUserId] defined on [field userId] from [field userId] is being defaulted to: seqGenUserId. 
2016-10-19T13:00:00.960+0200|Feiner: Class [de.fh_dortmund.hansen.chat.entity.UserEntity] registered to be processed by weaver. 
2016-10-19T13:00:00.962+0200|Feiner: Class [de.fh_dortmund.hansen.chat.entity.UserStatisticEntity] registered to be processed by weaver. 
2016-10-19T13:00:00.962+0200|Feiner: Class [de.fh_dortmund.hansen.chat.entity.StatisticEntity] registered to be processed by weaver. 
2016-10-19T13:00:00.962+0200|Feiner: Class [de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity] registered to be processed by weaver. 
2016-10-19T13:00:01.027+0200|Am feinsten: End predeploying Persistence Unit ChatDB; session /file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB; state Predeployed; factoryCount 1 
2016-10-19T13:00:01.032+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.StatisticEntity_] not found during initialization. 
2016-10-19T13:00:01.032+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity_] not found during initialization. 
2016-10-19T13:00:01.033+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.UserEntity_] not found during initialization. 
2016-10-19T13:00:01.033+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.UserStatisticEntity_] not found during initialization. 
2016-10-19T13:00:01.033+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.AdditionalEntityInformation_] not found during initialization. 
2016-10-19T13:00:01.370+0200|Am feinsten: Begin deploying Persistence Unit ChatDB; session /file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB; state Predeployed; factoryCount 1 
2016-10-19T13:00:01.374+0200|Am feinsten: Begin weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/UserEntity]. 
2016-10-19T13:00:01.381+0200|Am feinsten: Weaved change tracking (ChangeTracker) [de/fh_dortmund/hansen/chat/entity/UserEntity]. 
2016-10-19T13:00:01.382+0200|Am feinsten: Weaved fetch groups (FetchGroupTracker) [de/fh_dortmund/hansen/chat/entity/UserEntity]. 
2016-10-19T13:00:01.382+0200|Am feinsten: End weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/UserEntity]. 
2016-10-19T13:00:01.382+0200|Information: de.fh_dortmund.hansen.chat.entity.UserEntity actually got transformed 
2016-10-19T13:00:01.389+0200|Am feinsten: Begin weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.390+0200|Am feinsten: Weaved persistence (PersistenceEntity) [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.391+0200|Am feinsten: Weaved change tracking (ChangeTracker) [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.391+0200|Am feinsten: Weaved fetch groups (FetchGroupTracker) [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.391+0200|Am feinsten: Weaved REST [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.391+0200|Am feinsten: End weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/AdditionalEntityInformation]. 
2016-10-19T13:00:01.391+0200|Information: de.fh_dortmund.hansen.chat.entity.AdditionalEntityInformation actually got transformed 
2016-10-19T13:00:01.400+0200|Am feinsten: Begin weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/UserStatisticEntity]. 
2016-10-19T13:00:01.401+0200|Am feinsten: Weaved change tracking (ChangeTracker) [de/fh_dortmund/hansen/chat/entity/UserStatisticEntity]. 
2016-10-19T13:00:01.401+0200|Am feinsten: Weaved fetch groups (FetchGroupTracker) [de/fh_dortmund/hansen/chat/entity/UserStatisticEntity]. 
2016-10-19T13:00:01.401+0200|Am feinsten: End weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/UserStatisticEntity]. 
2016-10-19T13:00:01.401+0200|Information: de.fh_dortmund.hansen.chat.entity.UserStatisticEntity actually got transformed 
2016-10-19T13:00:01.402+0200|Am feinsten: Begin weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/StatisticEntity]. 
2016-10-19T13:00:01.403+0200|Am feinsten: Weaved change tracking (ChangeTracker) [de/fh_dortmund/hansen/chat/entity/StatisticEntity]. 
2016-10-19T13:00:01.404+0200|Am feinsten: Weaved fetch groups (FetchGroupTracker) [de/fh_dortmund/hansen/chat/entity/StatisticEntity]. 
2016-10-19T13:00:01.404+0200|Am feinsten: End weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/StatisticEntity]. 
2016-10-19T13:00:01.405+0200|Information: de.fh_dortmund.hansen.chat.entity.StatisticEntity actually got transformed 
2016-10-19T13:00:01.420+0200|Am feinsten: Begin weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/CommonStatisticEntity]. 
2016-10-19T13:00:01.422+0200|Am feinsten: Weaved change tracking (ChangeTracker) [de/fh_dortmund/hansen/chat/entity/CommonStatisticEntity]. 
2016-10-19T13:00:01.422+0200|Am feinsten: Weaved fetch groups (FetchGroupTracker) [de/fh_dortmund/hansen/chat/entity/CommonStatisticEntity]. 
2016-10-19T13:00:01.423+0200|Am feinsten: End weaver class transformer processing class [de/fh_dortmund/hansen/chat/entity/CommonStatisticEntity]. 
2016-10-19T13:00:01.423+0200|Information: de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity actually got transformed 
2016-10-19T13:00:01.449+0200|Feiner: initializing session manager 
2016-10-19T13:00:01.451+0200|Am feinsten: property=eclipselink.target-server; value=SunAS9; translated value=org.eclipse.persistence.platform.server.sunas.SunAS9ServerPlatform 
2016-10-19T13:00:01.451+0200|Am feinsten: property=eclipselink.logging.level; value=FINEST; translated value=FINEST 
2016-10-19T13:00:01.452+0200|Am feinsten: property=eclipselink.logging.level; value=FINEST; translated value=FINEST 
2016-10-19T13:00:01.452+0200|Am feinsten: property=eclipselink.target-database; value=MySQL; translated value=org.eclipse.persistence.platform.database.MySQLPlatform 
2016-10-19T13:00:01.465+0200|Information: EclipseLink, version: Eclipse Persistence Services - 2.6.1.v20150605-31e8258 
2016-10-19T13:00:01.470+0200|Konfiguration: connecting(DatabaseLogin(
    platform=>MySQLPlatform 
    user name=> "" 
    connector=>JNDIConnector datasource name=>null 
)) 
2016-10-19T13:00:01.922+0200|Konfiguration: Connected: jdbc:mysql://localhost:3306/chat 
    User: [email protected] 
    Database: MySQL Version: 5.7.16-log 
    Driver: MySQL Connector Java Version: mysql-connector-java-5.1.40 (Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6) 
2016-10-19T13:00:01.922+0200|Am feinsten: Connection acquired from connection pool [read]. 
2016-10-19T13:00:01.922+0200|Am feinsten: Connection released to connection pool [read]. 
2016-10-19T13:00:01.922+0200|Konfiguration: connecting(DatabaseLogin(
    platform=>MySQLPlatform 
    user name=> "" 
    connector=>JNDIConnector datasource name=>null 
)) 
2016-10-19T13:00:01.923+0200|Konfiguration: Connected: jdbc:mysql://localhost:3306/chat 
    User: [email protected] 
    Database: MySQL Version: 5.7.16-log 
    Driver: MySQL Connector Java Version: mysql-connector-java-5.1.40 (Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6) 
2016-10-19T13:00:01.929+0200|Am feinsten: sequencing connected, state is NoPreallocation_State 
2016-10-19T13:00:01.930+0200|Am feinsten: sequence seqGenStatId: preallocation size 50 
2016-10-19T13:00:01.930+0200|Am feinsten: sequence seqGenUserId: preallocation size 50 
2016-10-19T13:00:02.000+0200|Information: /file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB login successful 
2016-10-19T13:00:02.000+0200|Feiner: JMX MBeanServer instance found: [[email protected]], # of beans: [24], domain: [DefaultDomain] at index: [0]. 
2016-10-19T13:00:02.002+0200|Am feinsten: Registered MBean: org.eclipse.persistence.services.mbean.MBeanDevelopmentServices[TopLink:Name=Development-/file_/D_/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB,Type=Configuration] on server [email protected] 
2016-10-19T13:00:02.003+0200|Am feinsten: Registered MBean: org.eclipse.persistence.services.glassfish.MBeanGlassfishRuntimeServices[TopLink:Name=Session(/file_/D_/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB)] on server [email protected] 
2016-10-19T13:00:02.003+0200|Am feinsten: EclipseLink JMX Runtime Services is referencing the [Platform ConversionManager] ClassLoader at: [EarClassLoader : 
urlSet = [URLEntry : file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/, URLEntry : file:/D:/glassfish4/glassfish/domains/domain1/generated/ejb/Chat-ear/Chat-ejb_jar, URLEntry : file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-common.jar/] 
doneCalled = false 
Parent -> [email protected] 
] 
2016-10-19T13:00:02.003+0200|Am feinsten: The applicationName for the MBean attached to session [/file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB] is [D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_URLEntry _file:/D:/glassfish4/glassfish/domains/domain1/generated/ejb/Chat-ear/Chat-ejb_jar_URLEntry _file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-common.jar/] 
2016-10-19T13:00:02.003+0200|Am feinsten: The moduleName for the MBean attached to session [/file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB] is [_ChatDB] 
2016-10-19T13:00:02.015+0200|Am feinsten: The table (COMMONSTATISTICENTITY) is created. 
2016-10-19T13:00:02.016+0200|Am feinsten: The table (USERENTITY) is created. 
2016-10-19T13:00:02.016+0200|Am feinsten: The table (USERSTATISTICENTITY) is created. 
2016-10-19T13:00:02.018+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.StatisticEntity_] not found during initialization. 
2016-10-19T13:00:02.019+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.CommonStatisticEntity_] not found during initialization. 
2016-10-19T13:00:02.020+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.UserEntity_] not found during initialization. 
2016-10-19T13:00:02.021+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.UserStatisticEntity_] not found during initialization. 
2016-10-19T13:00:02.022+0200|Feiner: Canonical Metamodel class [de.fh_dortmund.hansen.chat.entity.AdditionalEntityInformation_] not found during initialization. 
2016-10-19T13:00:02.022+0200|Am feinsten: End deploying Persistence Unit ChatDB; session /file:/D:/glassfish4/glassfish/domains/domain1/eclipseApps/Chat-ear/Chat-ejb_jar/_ChatDB; state Deployed; factoryCount 1 
2016-10-19T13:00:09.314+0200|Fein: SELECT COUNT(USERID) FROM USERENTITY WHERE (USERNAME = ?) 
    bind => [1 parameter bound] 
2016-10-19T13:00:09.333+0200|Am feinsten: Connection released to connection pool [read]. 
2016-10-19T13:00:09.335+0200|Am feinsten: persist() operation called on: [email protected]. 
2016-10-19T13:00:09.397+0200|Feiner: begin unit of work flush 
2016-10-19T13:00:09.397+0200|Feiner: TX beginTransaction, status=STATUS_ACTIVE 
2016-10-19T13:00:09.398+0200|Am feinsten: Execute query InsertObjectQuery([email protected]) 
2016-10-19T13:00:09.398+0200|Am feinsten: Connection acquired from connection pool [default]. 
2016-10-19T13:00:09.398+0200|Am feinsten: reconnecting to external connection pool 
2016-10-19T13:00:09.399+0200|Fein: INSERT INTO COMMONSTATISTICENTITY (CREATEDAT, ENDDATE, LOGINS, LOGOUTS, MESSAGES, STARTINGDATE, UPDATEDAT) VALUES (?, ?, ?, ?, ?, ?, ?) 
    bind => [7 parameters bound] 
2016-10-19T13:00:09.405+0200|Am feinsten: Execute query ValueReadQuery(name="seqGenStatId" sql="SELECT LAST_INSERT_ID()") 
2016-10-19T13:00:09.405+0200|Fein: SELECT LAST_INSERT_ID() 
2016-10-19T13:00:09.406+0200|Am feinsten: assign sequence to the object (1 -> [email protected]) 
2016-10-19T13:00:09.407+0200|Feiner: end unit of work flush 
2016-10-19T13:00:09.408+0200|Feiner: resume unit of work 
2016-10-19T13:00:09.408+0200|Am feinsten: Execute query ReportQuery(name="getNumUsersWithName" referenceClass=UserEntity sql="SELECT COUNT(USERID) FROM USERENTITY WHERE (USERNAME = ?)") 
2016-10-19T13:00:09.409+0200|Fein: SELECT COUNT(USERID) FROM USERENTITY WHERE (USERNAME = ?) 
    bind => [1 parameter bound] 
2016-10-19T13:00:09.412+0200|Am feinsten: persist() operation called on: [email protected] 
2016-10-19T13:00:09.421+0200|Feiner: TX beforeCompletion callback, status=STATUS_ACTIVE 
2016-10-19T13:00:09.421+0200|Feiner: begin unit of work commit 
2016-10-19T13:00:09.422+0200|Am feinsten: Execute query InsertObjectQuery([email protected]) 
2016-10-19T13:00:09.423+0200|Fein: INSERT INTO USERENTITY (CREATEDAT, LOGGEDIN, PASSWORDHASH, STATS, UPDATEDAT, USERNAME) VALUES (?, ?, ?, ?, ?, ?) 
    bind => [6 parameters bound] 
2016-10-19T13:00:09.425+0200|Am feinsten: Execute query ValueReadQuery(name="seqGenUserId" sql="SELECT LAST_INSERT_ID()") 
2016-10-19T13:00:09.425+0200|Fein: SELECT LAST_INSERT_ID() 
2016-10-19T13:00:09.426+0200|Am feinsten: assign sequence to the object (1 -> [email protected]) 
2016-10-19T13:00:09.431+0200|Am feinsten: Connection released to connection pool [default]. 

EDIT2: UserStatisticEntity est sérialisable par héritage, si je retire que serializablility, mes pauses de déploiement ejb, avec cette erreur:

Exception Description: The type [class de.fh_dortmund.hansen.chat.entity.UserStatisticEntity] for the attribute [stats] on the entity class [class de.fh_dortmund.hansen.chat.entity.UserEntity] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface. 
+0

pourquoi ne pas poster le schéma créé par votre fournisseur JPA, le code de persistance, le journal? –

+0

Ajout du schéma créé (comme dit le bit important), je devine, que l'erreur a quelque chose à voir avec, pourquoi STATS est créé comme longblob et pas comme clé étrangère/bigint. Qu'est-ce qu'un code de persistance? Cela prendra un peu plus de temps pour trouver le bon journal. – Lumentus

+0

avez-vous mis '@ Entity' sur votre autre entité ?! "code de persistance" correspond aux appels d'API JPA que vous avez utilisés pour créer et PERSISTER vos objets. –

Répondre

1

La solution est très simple Comme je le pensais. Pour une raison quelconque, Eclipselink est vraiment dérangé par le fait que, pour un UserStatisticEntity est sérialisable et que j'avais toutes ces annotations sur le champ stats. Après avoir fait ce non-sérialisable, puis retirer la @Basic et @Column annotations le code suivant fonctionne:

@OneToOne(cascade={CascadeType.PERSIST, CascadeType.REMOVE}) 
@JoinColumn(nullable=false,unique=true) 
private UserStatisticEntity stats; 
+0

Toute entité associée peut être sérialisable, donc si Eclipselink a vraiment un problème avec cela, alors élevez un bug sur votre fournisseur.'@ Basic 'sur un champ de relation est tout à fait fausse mais ne devrait pas faire faire des choses étranges à votre fournisseur JPA - il devrait simplement signaler une erreur (peut-être connecté) et continuer –

+0

Après avoir rendu UserStatisticEntity non sérialisable, j'ai également enlevé les' ' @ Annotation JoinColumn' et '@ Basic'. Puis Eclipselink a commencé à se plaindre, que je devrais utiliser '@ JoinColumn' au lieu de' @ Column', ce qui, d'une manière ou d'une autre, a permis à Eclipselink de comprendre qu'il devrait utiliser une clé étrangère au lieu d'un blob. – Lumentus