A library for intelligent database schema discovery and natural language query processing using LLM integration.
The project is structured into several modules:
spring-data-llm-adapter: Core functionality for schema discovery and management (technology-agnostic)spring-data-llm-adapter-jpa: JPA-specific schema discovery implementationstarters/: Spring Boot integration modulesspring-data-llm-adapter-jpa-starter: Spring Boot starter for JPA functionality onlyspring-data-llm-adapter-starter: Complete Spring Boot starter (JPA + future modules)
spring-data-llm-adapter/
├── spring-data-llm-adapter/ # Core functionality (technology-agnostic)
├── spring-data-llm-adapter-jpa/ # JPA-specific schema discovery
├── starters/ # Spring Boot integration modules
│ ├── spring-data-llm-adapter-jpa-starter/ # JPA starter
│ └── spring-data-llm-adapter-starter/ # Complete starter
├── examples/ # Example applications
│ └── jpa-example/ # Complete working example
├── pom.xml # Parent POM
└── README.md # This file
Add the complete starter to your Spring Boot project:
<dependency>
<groupId>ai.hadirsa</groupId>
<artifactId>spring-data-llm-adapter-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>If you only need specific functionality:
<!-- For JPA schema discovery only -->
<dependency>
<groupId>ai.hadirsa</groupId>
<artifactId>spring-data-llm-adapter-jpa-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
For maximum control, use the individual modules:
<dependency>
<groupId>ai.hadirsa</groupId>
<artifactId>spring-data-llm-adapter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ai.hadirsa</groupId>
<artifactId>spring-data-llm-adapter-jpa</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>@DataAgent(
description = "User entity for authentication and profile management",
discoverable = true
)
@Entity
@Table(name = "users")
class User(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
@Column(name = "username", unique = true, nullable = false)
val username: String,
@Column(name = "email", unique = true, nullable = false)
val email: String
)@EnableDataAgent(
packages = "ai.hadirsa.examples.jpa.domain",
autoDiscover = true
)
@SpringBootApplication
class YourApplication
fun main(args: Array<String>) {
runApplication<YourApplication>(*args)
}GET /api/jpa/schemas- Get all discovered schemasPOST /api/jpa/discover- Trigger schema discoveryGET /api/jpa/schemas/{className}- Get specific schema
Example responses (Profile entity):
{
"entityClassName": "ai.hadirsa.examples.jpa.domain.Profile",
"tableName": "UM_PROFILE",
"description": "Example JPA entity Profile for demonstration purposes",
"fields": [
{
"fieldName": "id",
"columnName": "id",
"fieldType": "String",
"columnType": "VARCHAR",
"nullable": true,
"unique": false,
"length": 255,
"precision": null,
"scale": null,
"description": "Unique identifier for the profile",
"examples": "uuid-string",
"category": "identification",
"primaryKey": true
},
{
"fieldName": "ssn",
"columnName": "ssn",
"fieldType": "String",
"columnType": "VARCHAR",
"nullable": true,
"unique": true,
"length": null,
"precision": null,
"scale": null,
"description": "Social security number",
"examples": "123-45-6789",
"category": "personal_info",
"primaryKey": false
},
...
],
"relationships": [
{
"fieldName": "user",
"targetEntity": "ai.hadirsa.examples.jpa.domain.User",
"relationshipType": "OneToOne",
"mappedBy": "profile",
"joinColumn": null,
"cascadeTypes": [],
"fetchType": "EAGER"
}
]
}- Automatic scanning of
@DataAgentannotated entities - Caching
- REST API for schema information
See the examples/ directory for complete working applications:
jpa-example/- Complete example with JPA
./mvnw clean install./mvnw testcd examples/jpa-example
./mvnw spring-boot:run- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE.txt file for details.