Skip to content

Conversation

@thomasdarimont
Copy link

Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.
We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).
Opened-up API for customization in sub-classes.

Original pull request #66.

…trict checking and shouldCreatePersistentEntity is wrong.
@odrotbohm
Copy link
Member

I don't quite like the extraction of the protected methods as it exposes internals to subclasses that could be achieved by using the existing hooks (implementations of PersistentEntity and PersistentProperty).

I am not totally against refactoring the code to provide more hooks, it's just that it seems to happen here without any context and justification.

@thomasdarimont
Copy link
Author

The protected methods come from Michaels initial commit and I thought it is useful to have this hooks to be able to provide more sophisticated customizations.

I can make those methods private if you prefer - then we could probably inline publishMappingContextEvent and verifyEntity.

@jexp Could we make those methods private or do you need those for further MappingContext customizations in SD Neo4J?

@jexp
Copy link
Contributor

jexp commented Mar 4, 2014

I actually do more customization.
Wouldn't it make sense then to move the content of these methods into PE, PP too?

@odrotbohm
Copy link
Member

I suggest to to open a new ticket to provide more context about the intended changes and proceed with just the strict-checks fixed for this PR.

@thomasdarimont
Copy link
Author

I reduced this PR to only contain the changed ordering of the checks in AbstractMappingContext.getPersistentEntity(TypeInformation).

I created https://jira.springsource.org/browse/DATACMNS-459 to track the refactoring efforts.

…tentEntity type.

Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.
We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a  MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).

Original pull request #66.
@odrotbohm
Copy link
Member

@jexp - Would you mind elaborating in DATACMNS-459 on why you think the changes where necessary?

jexp added a commit that referenced this pull request Mar 5, 2014
Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.

We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a  MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).

Original pull requests: #66, #71.
jexp added a commit that referenced this pull request Mar 5, 2014
Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.

We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a  MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).

Original pull requests: #66, #71.
jexp added a commit that referenced this pull request Mar 5, 2014
Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.

We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a  MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).

Original pull requests: #66, #71.
@odrotbohm odrotbohm closed this Mar 5, 2014
@odrotbohm odrotbohm deleted the issue/DATACMNS-447 branch March 5, 2014 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants