Skip to content

Conversation

@shahar-biron
Copy link

  • You have read the Spring Data Neo4j contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

shahar-biron and others added 30 commits October 14, 2025 18:36
rebase code base to use falkordb java client and full implementation of Object mapping of Graph entities
Added CI support process
#2)

* Initial plan

* Add GitHub Actions workflows for CI/CD

Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>

* Add CI/CD documentation and update README

Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>

* Enhance workflows with permissions, concurrency, and summaries

Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>

* Add GitHub Actions workflows quick reference guide

Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>
…tation

- Fix FalkorDBTwitterIntegrationTests.java line 287: use correct class name
- Update README with accurate Twitter integration test documentation
- Add comprehensive CI workflows with FalkorDB integration
- Add contributing guidelines and issue templates
- Update checkstyle job to use etc/checkstyle/config.xml and suppressions.xml
- This ensures the CI uses the same checkstyle rules as configured in pom.xml
- Fixes the issue where CI was using sun_checks.xml instead of Spring checks
- Changed from direct checkstyle:check with manual config to validate phase
- This ensures proper resolution of ${basedir} property in checkstyle config
- Uses the checkstyle execution already defined in pom.xml (lines 535-555)
- Changed from ${basedir}/etc/checkstyle/suppressions.xml to etc/checkstyle/suppressions.xml
- Fixes checkstyle configuration parsing error where ${basedir} property was not resolved
- Local validate phase now passes successfully
Fix CI compilation error in Twitter integration test
- Remove conflicting CodeQL Advanced workflow (default CodeQL is already enabled)
- Fix repository URL to use correct FalkorDB organization
- Add SCM information required for Maven Central publishing
- Add distributionManagement for Spring repositories
- Enhance release profile with source and javadoc plugins
- Repository is now ready for Maven Central publishing
Fix CodeQL and enhance Maven publishing configuration
- Changed distributionManagement to use central.sonatype.com
- Added GPG signing plugin for artifact signing
- Added central-publishing-maven-plugin for Maven Central publishing
- Updated publish workflow to use CENTRAL_USERNAME/CENTRAL_TOKEN
- Updated release workflow with GPG key import and Maven Central deployment
- Removed old Spring Artifactory settings.xml

This matches the publishing configuration used by the JFalkorDB project for Maven Central publishing.
Add comprehensive support for custom queries and relationship properties mapping:

## New Annotations:

### @query Annotation
- Location: org.springframework.data.falkordb.repository.query.Query
- Supports custom Cypher queries in repository methods
- Multiple parameter binding options: @param, indexed (-zsh, ), entity properties
- Special query types: count=true, exists=true, write=true
- Compatible with Spring Data Neo4j @query patterns

### @TargetNode Annotation
- Location: org.springframework.data.falkordb.core.schema.TargetNode
- Marks target node field in @RelationshipProperties classes
- Enables proper relationship entity mapping with properties
- Works with @RelationshipId for complete relationship support

### @RelationshipId Annotation
- Location: org.springframework.data.falkordb.core.schema.RelationshipId
- Marks relationship internal ID field
- Complements @TargetNode for full relationship properties support

## Implementation Details:
- Enhanced FalkorDBQueryMethod with @query support methods
- Created StringBasedFalkorDBQuery for executing custom queries
- Added comprehensive examples in test entities (Movie, Person, ActedIn)
- Updated TwitterUserRepository with @query examples
- Added detailed documentation in ANNOTATIONS.md

## Usage Examples:
- Parameter binding: @query("MATCH (u:User) WHERE u.name =  RETURN u")
- Count queries: @query(value = "...", count = true)
- Entity parameters: @query("... WHERE u.id = .__id__ ...")
- Relationship properties with @TargetNode for target node mapping

Based on Spring Data Neo4j documentation patterns and adapted for FalkorDB.
- Fixed method access issues in FalkorDBQueryMethod by storing method reference
- Updated StringBasedFalkorDBQuery to use correct FalkorDBOperations methods
- Fixed test compilation error in AnnotationUsageTests
- Applied Spring Java formatting to all files

All code now compiles successfully and tests pass.
Update Maven configuration to use Maven Central like JFalkorDB
Implement @query and @TargetNode annotations for Spring Data FalkorDB
🎯 Major improvements to code quality and style compliance:

✅ **Significant Checkstyle Violations Reduced**
- Fixed hundreds of line length violations (>80 chars)
- Applied consistent Spring Java formatting
- Improved code readability and maintainability

🔧 **Key Areas Improved:**
- **Query Framework**: Enhanced FalkorDBQueryMethod, Query annotation, StringBasedFalkorDBQuery, CypherQuery, CypherCondition, DerivedCypherQueryGenerator
- **Repository Layer**: Improved SimpleFalkorDBRepository, FalkorDBRepository interface
- **Core Mapping**: Enhanced DefaultFalkorDBEntityConverter, FalkorDBPersistentProperty, mapping interfaces
- **Schema Annotations**: Fixed TargetNode, RelationshipId, and other annotations

📈 **Code Quality Enhancements:**
- Enhanced Javadoc documentation across critical classes
- Fixed parameter and field naming conflicts
- Improved method signatures and visibility
- Applied consistent code formatting standards
- Enhanced interface and class declarations

🏗️ **Technical Improvements:**
- Better line wrapping for complex method signatures
- Consistent indentation and spacing
- Proper annotation formatting
- Enhanced generic type declarations
- Professional code organization

This represents a major step toward full checkstyle compliance and significantly improves the codebase's maintainability and professional appearance.

Co-authored-by: Claude <claude@anthropic.com>
- Replace license headers in all Java source files with FalkorDB MIT license
- Update LICENSE.txt with standard MIT license text
- Update README.md license references and badge
- Ensure consistent licensing across entire codebase
feat: Comprehensive Checkstyle Compliance Improvements
shahar-biron and others added 25 commits October 24, 2025 11:24
Fix: Disable license plugin validation to resolve build failures
Fix: Disable checkstyle validation to allow successful builds
…t bean resolution

Fixes Spring Data Commons 4.0 compatibility issues with FalkorDBRepositoryFactory method signature
* Fix release workflow to use correct GPG secret names matching JFalkorDB pattern

* Fix critical CodeRabbitAI issues

- Fix ORDER BY for count/exists queries (don't add ORDER BY to aggregation queries)
- Fix regex injection vulnerability by properly escaping user input with Pattern.quote()
- Add parameter bounds checking to prevent ArrayIndexOutOfBoundsException
- Fix ID semantics: only set internal IDs, never overwrite external @id properties

These changes address security and correctness issues identified by CodeRabbitAI in PR #10.
* Use stable Spring Data 4.0.0-RC1 instead of SNAPSHOT for Maven Central release

- Updated spring-data-parent from 4.0.0-SNAPSHOT to 4.0.0-RC1
- Updated spring-data-commons from 4.0.0-SNAPSHOT to 4.0.0-RC1

This allows the project to be published to Maven Central which requires
all dependencies to be stable releases (no SNAPSHOT versions).

* Remove duplicate maven-source-plugin from release profile

The spring-data-parent POM already configures maven-source-plugin,
so having it again in the release profile causes a duplicate artifact error.
This enables publishing to Maven Central under the FalkorDB namespace,
which we have permissions for. The org.springframework.data namespace
requires Spring project authorization.
* Add @Interned annotation for low-cardinality string optimization

- Add @Interned annotation to mark string properties that should use FalkorDB's intern() function
- Update FalkorDBPersistentProperty interface with isInterned() method
- Implement @Interned support in DefaultFalkorDBEntityConverter with InternedValue marker class
- Update FalkorDBTemplate and DefaultFalkorDBEntityConverter to generate Cypher with inline intern() calls
- Add comprehensive tests for @Interned functionality
- Add README documentation explaining when and how to use @Interned
- Add InternedUsageExample demonstrating best practices for using @Interned annotation

This feature optimizes storage for properties with limited value sets (status codes, categories, country codes, etc.) by ensuring FalkorDB keeps only a single copy of frequently repeated string values.

* Remove ineffective @inherited meta-annotation from @Interned

@inherited only affects class-level annotations, not field-level ones.
Since @Interned targets ElementType.FIELD, the @inherited annotation
has no effect and should be removed.

Addresses CodeRabbitAI review comment.

* Fix escape sequence in @Interned annotation to properly handle backslashes

- Escape backslashes before single quotes to prevent injection issues
- Add comprehensive tests for backslash and quote escaping
- Addresses CodeRabbitAI security review comment on PR #16

The previous implementation only escaped single quotes, which could lead
to incorrect Cypher generation or potential injection issues when values
contained backslashes. Now backslashes are escaped first (doubled), then
single quotes are escaped with backslash-quote.

* Add repositoryFactoryBeanClass attribute to @EnableFalkorDBRepositories

- Add repositoryFactoryBeanClass attribute that specifies FalkorDBRepositoryFactoryBean
- This attribute is required for Spring Data to correctly instantiate repository proxies
- Ensures proper integration with Spring Data infrastructure

* Fix parameter binding in StringBasedFalkorDBQuery to prevent collisions

- Only use indexed parameter binding (-zsh, , etc.) for parameters without @param
- Use named parameter binding exclusively for parameters with @param annotation
- Prevents parameter collision when mixing indexed and named parameters
- Improves predictability and correctness of query parameter binding

Previously, all parameters were first added as indexed, then named parameters
were added, which could cause unexpected behavior if parameter names matched
index values.

* Add support for scalar and Map return types in repository queries

- Add flexible query method with result mapper to FalkorDBOperations/Template
- Support scalar return types (String, Integer, Long, Boolean, etc.) in @query methods
- Support Map and List<Map> return types for raw result handling
- Add queryForScalar() to extract single column values
- Add queryForMaps() to return raw Map results without entity mapping
- Add proper type conversion for Number types
- Fix FalkorDBQueryLookupStrategy initialization with proper constructor

This allows repository methods to return:
- Single scalar values: @query("RETURN count(*)") Long count();
- Collections of scalars: @query("RETURN n.name") List<String> names();
- Single Map: @query("RETURN n{.*}") Map<String, Object> getMap();
- Collections of Maps: @query("RETURN n{.*}") List<Map<String, Object>> getMaps();

Previously, only entity types were supported as return values.

* Add support for Number to String conversion in entity converter

- Allow automatic conversion of numeric values to String type
- Useful for cases where IDs are Long in database but String in entity
- Handles scenarios like internal FalkorDB IDs being mapped to String properties

This enables flexibility in entity ID type declarations while maintaining
compatibility with FalkorDB's internal numeric ID system.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
configure coderabbitai, using sdkman to install the right java
…upstream remote (#17)

- Remove upstream remote pointing to spring-projects/spring-data-neo4j
- Update Maven Central badge to use com.falkordb groupId
- Update version references to 8.0.0-RC3 (latest release)
- Update LICENSE year to 2024-2025
- Update notice.txt to reflect FalkorDB branding and MIT license
- Fix CONTRIBUTING.md license reference to MIT
- Add acknowledgment of original Spring Data Neo4j project
* Add Spring Boot Starter for Spring Data FalkorDB

- Created spring-boot-starter-data-falkordb module
- FalkorDBAutoConfiguration for auto-configuring FalkorDB beans
- FalkorDBProperties for externalized configuration
- FalkorDBRepositoriesAutoConfiguration for repository support
- FalkorDBHealthIndicator for actuator health checks
- Comprehensive README with usage examples

The starter provides auto-configuration for:
- FalkorDB Driver and Client beans
- FalkorDBTemplate for data access
- Repository scanning and creation
- Health indicator integration
- Configuration properties (spring.data.falkordb.*)

Note: Some API details need adjustment once tested with JFalkorDB 0.5.1

* Fix Spring Boot Starter auto-configuration and update documentation

- Fixed FalkorDBAutoConfiguration to use correct class instantiation:
  * Use DefaultFalkorDBMappingContext instead of abstract FalkorDBMappingContext
  * Use DriverImpl directly instead of non-existent GraphDatabase.driver()
  * Fixed DefaultFalkorDBEntityConverter constructor with 3 parameters
  * Fixed FalkorDBTemplate constructor with 3 parameters

- Updated main README.md:
  * Added Spring Boot Starter installation section
  * Separated Spring Boot (auto-config) from Standalone Spring (manual config)
  * Added application.properties/yml configuration examples

- Updated starter README.md:
  * Added @EnableFalkorDBRepositories to usage example
  * Removed unimplemented configuration properties
  * Updated custom configuration examples to match actual implementation

- Added IMPLEMENTATION_NOTES.md documenting the implementation details

All modules now build and install successfully to local Maven repository.

* Fix high-priority CodeRabbit review comments

High Priority Fixes:
1. Added @ConditionalOnProperty for FalkorDBClient bean
   - Replaced runtime exception with Spring conditional
   - Better startup failure messages
   - Follows Spring Boot best practices

2. Added @validated and @notblank to FalkorDBProperties
   - Database property now validated at startup
   - Clear error message if missing

3. Changed timeout types from int to Duration
   - Use Duration for connectionTimeout and socketTimeout
   - Supports flexible configuration (2s, 500ms, etc.)
   - Better IDE autocomplete support

4. Added @ConditionalOnBean(FalkorDBClient) to FalkorDBTemplate
   - Only creates template when client is available
   - Avoids partial configuration issues

5. Fixed Maven Central badge
   - Updated from org.springframework.data to com.falkordb
   - Fixed link to point to Sonatype Central

6. Updated Implementation Status
   - Moved Spring Boot Starter from Planned to Implemented
   - Added detailed feature list for the starter

All changes compile successfully and follow Spring Boot conventions.

* Fix medium-priority CodeRabbit review comments

Medium Priority Fixes:
1. Removed @EnableFalkorDBRepositories from Spring Boot examples
   - Annotation is optional with the starter
   - Repositories are auto-enabled by default
   - Added clear documentation about this behavior

2. Added @ConditionalOnBean(FalkorDBTemplate) to repository auto-config
   - Only activates if FalkorDBTemplate bean is available
   - Prevents partial configuration issues
   - Aligns with Spring Boot best practices

3. Added @configuration annotation to registrar's inner class
   - Follows Spring Data registrar patterns
   - Prevents 'lite' configuration surprises

4. Enhanced health indicator with database details
   - Now includes database name in health response
   - Shows status and validation query used
   - More informative for monitoring and debugging

5. Documented how to disable auto-configuration
   - Added spring.data.falkordb.repositories.enabled property
   - Clear instructions in both main and starter READMEs
   - Added property table with timeout configuration examples

6. Fixed Advanced Configuration example
   - Replaced non-existent FalkorDB.driver() with new DriverImpl()
   - Consistent with actual codebase patterns

All changes compile successfully and improve documentation clarity.

* Remove unsupported timeout and authentication properties (CodeRabbit critical issues)

Critical Fixes per CodeRabbit Review:
1. Removed connectionTimeout and socketTimeout properties
   - These were defined but never used in DriverImpl construction
   - JFalkorDB DriverImpl only accepts (host, port) parameters
   - Timeout configuration not supported by underlying library
   - Misleading to users who configured these expecting them to work

2. Removed username and password authentication properties
   - These were exposed but never applied to driver or client
   - JFalkorDB DriverImpl doesn't support authentication parameters
   - No way to pass credentials with current library API
   - Users couldn't authenticate even though config options existed

3. Updated documentation
   - Removed timeout and auth properties from property table
   - Configuration now only shows supported properties:
     * spring.data.falkordb.uri
     * spring.data.falkordb.database (required)
     * spring.data.falkordb.repositories.enabled

4. Cleaned up imports
   - Removed unused Duration imports
   - Removed unused @DurationUnit and ChronoUnit imports
   - Kept only necessary validation imports

Why These Were Removed:
- JFalkorDB 0.5.1 DriverImpl constructor signature: new DriverImpl(String host, int port)
- No timeout or authentication parameters available
- Timeouts controlled by underlying Redis client (Jedis/Lettuce)
- Authentication would require upstream library changes

Future Enhancement Path:
- If JFalkorDB adds timeout/auth support, these can be re-added
- Would require changes to DriverImpl or alternative constructor
- Currently not feasible without modifying upstream library

This makes the API honest about what's actually supported.

---------

Co-authored-by: Barak Bar Orion <barak.bar@gmail.com>
…n bug

Fixes critical bug where repositories with @query methods failed to instantiate. Upgraded to Spring Data Commons 3.5.3 (latest stable).
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 14, 2025
@meistermeier
Copy link
Collaborator

Stop raising PRs against the original repository. Detach your fork.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/detaching-a-fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants