'Cassandra datastax @Entity-annotated class must have at least one property defined

I have below Entity class used Datastax java driver 4.1.x

package com.xyz;

import com.datastax.oss.driver.api.mapper.annotations.CqlName;
import com.datastax.oss.driver.api.mapper.annotations.Entity;
import com.datastax.oss.driver.api.mapper.annotations.PartitionKey;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Xyz {

    @PartitionKey
    @CqlName("id")
    private Integer id;

    @CqlName("name")
    private String name;

    @CqlName("description")
    private String description;
}

While doing mvn clean package/mvn clean install, getting below error (not compiled Entity class)

[Xyz] @Entity-annotated class must have at least one property defined.



Solution 1:[1]

You can use the zip() function, it returns an iterator of tuples based on the iterable objects.

import os

dir1 = os.listdir("directory1")  # e.g., [a1, a2, a3, a4, a5]
dir2 = os.listdir("directory2")  # e.g., [b1, b2, b3]

for (file1, file2) in zip(dir1, dir2):
    # Do your stuff
    print(file1 + " | " + file2)

# Output:
# a1 | b1
# a2 | b2
# a3 | b3

Note that the iterator stops when the shortest iterable is exhausted.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1